diff options
-rw-r--r-- | editors/vi.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/editors/vi.c b/editors/vi.c index 1bc2d08ad..7a7247c10 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -3021,15 +3021,9 @@ static int find_range(char **start, char **stop, char c) | |||
3021 | q = dot; | 3021 | q = dot; |
3022 | } else if (strchr("wW", c)) { | 3022 | } else if (strchr("wW", c)) { |
3023 | do_cmd(c); // execute movement cmd | 3023 | do_cmd(c); // execute movement cmd |
3024 | // if we are at the next word's first char | 3024 | // step back one char, but not if we're at end of file |
3025 | // step back one char | 3025 | if (dot > p && !((dot == end - 2 && end[-1] == '\n') || dot == end - 1)) |
3026 | // but check the possibilities when it is true | 3026 | dot--; |
3027 | if (dot > text && ((isspace(dot[-1]) && !isspace(dot[0])) | ||
3028 | || (ispunct(dot[-1]) && !ispunct(dot[0])) | ||
3029 | || (isalnum(dot[-1]) && !isalnum(dot[0])))) | ||
3030 | dot--; // move back off of next word | ||
3031 | if (dot > text && *dot == '\n') | ||
3032 | dot--; // stay off NL | ||
3033 | q = dot; | 3027 | q = dot; |
3034 | } else if (strchr("H-k{", c) || (c == 'G' && !forward)) { | 3028 | } else if (strchr("H-k{", c) || (c == 'G' && !forward)) { |
3035 | // these operate on multi-lines backwards | 3029 | // these operate on multi-lines backwards |