X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=editors%2Fvi.c;h=57b011444bc4d3b512fafd6c4b81b91731537336;hb=ef8cd3be17f0be6017af50f70e09093f5908c7c3;hp=35ce172d66ba953f266bce5bf75f67b6f5315f31;hpb=d10f36fe2e553f804dff96a5b82770fd46be0834;p=oweals%2Fbusybox.git diff --git a/editors/vi.c b/editors/vi.c index 35ce172d6..57b011444 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.32 2004/02/04 11:19:44 andersen Exp $"; /* * To compile for standalone use: @@ -1669,8 +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 (dot > text) - 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; @@ -3195,7 +3200,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++) {