summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn L McGrath2004-01-21 10:59:45 +0000
committerGlenn L McGrath2004-01-21 10:59:45 +0000
commitee829065cb7c52e3dfb74b35939ef08b9578a0b5 (patch)
tree744d28c88d5f307fd899b6dd08760fe43e0eb822
parenteaf5bc003839fd5844db4a827b86b621f7084fad (diff)
downloadbusybox-ee829065cb7c52e3dfb74b35939ef08b9578a0b5.zip
busybox-ee829065cb7c52e3dfb74b35939ef08b9578a0b5.tar.gz
Patch by Richard Kojedzinszky, when using END at end of lines it was
skipping to next line, cw command was leaving one char in buffer
-rw-r--r--editors/vi.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/editors/vi.c b/editors/vi.c
index 35ce172..ac3a175 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -19,7 +19,7 @@
*/
static const char vi_Version[] =
- "$Id: vi.c,v 1.30 2003/12/23 20:45:14 andersen Exp $";
+ "$Id: vi.c,v 1.31 2004/01/21 10:59:45 bug1 Exp $";
/*
* To compile for standalone use:
@@ -1669,7 +1669,9 @@ static Byte find_range(Byte ** start, Byte ** stop, Byte c)
q = dot;
} else if (strchr("wW", c)) {
do_cmd(c); // execute movement cmd
- if (dot > text)
+ // 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 (dot > text && *dot == '\n')
dot--; // stay off NL
@@ -3195,7 +3197,7 @@ key_cmd_mode:
if (cmdcnt-- > 1) {
do_cmd(c);
} // repeat cnt
- dot = end_line(dot + 1);
+ dot = end_line(dot);
break;
case '%': // %- find matching char of pair () [] {}
for (q = dot; q < end && *q != '\n'; q++) {