aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--editors/vi.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/editors/vi.c b/editors/vi.c
index 01597fa5e..adfb2b87c 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -3047,12 +3047,15 @@ static int find_range(char **start, char **stop, char c)
do_cmd(c); // execute movement cmd
dot_end(); // find NL
q = dot;
- } else {
- // nothing -- this causes any other values of c to
- // represent the one-character range under the
- // cursor. this is correct for ' ' and 'l', but
- // perhaps no others.
- //
+ } else /* if (c == ' ' || c == 'l') */ {
+ // forward motion by character
+ int tmpcnt = (cmdcnt ?: 1);
+ do_cmd(c); // execute movement cmd
+ // exclude last char unless range isn't what we expected
+ // this indicates we've hit EOL
+ if (tmpcnt == dot - p)
+ dot--;
+ q = dot;
}
if (q < p) {
t = q;