summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen2004-02-04 11:19:44 +0000
committerEric Andersen2004-02-04 11:19:44 +0000
commitaeea32ca696c0c68836d8dc2dfc22abd435f444f (patch)
treecbe5216947fcbbe1aca214fae0c2f1d3575d590e
parentef43749e83592288c9e8048689edaf72498784b8 (diff)
downloadbusybox-aeea32ca696c0c68836d8dc2dfc22abd435f444f.zip
busybox-aeea32ca696c0c68836d8dc2dfc22abd435f444f.tar.gz
Richard Kojedzinszky writes:
Hi, I've noticed the bug also, and here is another patch for it. I hope it'll not introduce more bugs. Not too nice, but works for me. Here it is for busybox-1.00-pre6
-rw-r--r--editors/vi.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/editors/vi.c b/editors/vi.c
index ac3a175..57b0114 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -19,7 +19,7 @@
*/
static const char vi_Version[] =
- "$Id: vi.c,v 1.31 2004/01/21 10:59:45 bug1 Exp $";
+ "$Id: vi.c,v 1.32 2004/02/04 11:19:44 andersen Exp $";
/*
* To compile for standalone use:
@@ -1669,10 +1669,13 @@ static Byte find_range(Byte ** start, Byte ** stop, Byte c)
q = dot;
} else if (strchr("wW", c)) {
do_cmd(c); // execute movement cmd
- // if we are at the next word's first char
- // step back one char
- if (dot > text && isspace(dot[-1]))
- dot--; // move back off of next word
+ // if we are at the next word's first char
+ // step back one char
+ // but check the possibilities when it is true
+ if (dot > text && ((isspace(dot[0]) && !isspace(dot[0]))
+ || (ispunct(dot[-1]) && !ispunct(dot[0]))
+ || (isalnum(dot[-1]) && !isalnum(dot[0]))))
+ dot--; // move back off of next word
if (dot > text && *dot == '\n')
dot--; // stay off NL
q = dot;