aboutsummaryrefslogtreecommitdiff
path: root/editors/vi.c
diff options
context:
space:
mode:
Diffstat (limited to 'editors/vi.c')
-rw-r--r--editors/vi.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/editors/vi.c b/editors/vi.c
index 01597fa5e..458ca6293 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -522,7 +522,7 @@ static void show_help(void)
static void write1(const char *out)
{
- fputs(out, stdout);
+ fputs_stdout(out);
}
#if ENABLE_FEATURE_VI_WIN_RESIZE
@@ -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;