diff --git a/tmux.1 b/tmux.1 index 820a11b9..0f8e0c13 100644 --- a/tmux.1 +++ b/tmux.1 @@ -2322,6 +2322,11 @@ that line. (emacs: C\-Down) .Xc Scroll down. +If +.Ic mode\-keys +is +.Ic vi , +the cursor is fixed relative to the text. .It Xo .Ic scroll\-down\-and\-cancel .Xc @@ -2363,6 +2368,11 @@ that line. (emacs: C\-Up) .Xc Scroll up. +If +.Ic mode\-keys +is +.Ic vi , +the cursor is fixed relative to the text. .It Xo .Ic search\-again (vi: n) diff --git a/window-copy.c b/window-copy.c index b33aa97d..f06b179b 100644 --- a/window-copy.c +++ b/window-copy.c @@ -6105,6 +6105,7 @@ static void window_copy_cursor_up(struct window_mode_entry *wme, int scroll_only) { struct window_copy_mode_data *data = wme->data; + struct options *oo = wme->wp->window->options; struct screen *s = &data->screen; u_int ox, oy, px, py; int norectsel; @@ -6120,6 +6121,11 @@ window_copy_cursor_up(struct window_mode_entry *wme, int scroll_only) if (data->lineflag == LINE_SEL_LEFT_RIGHT && oy == data->sely) window_copy_other_end(wme); + if (scroll_only && options_get_number(oo, "mode-keys") == MODEKEY_VI) { + if (data->cy < screen_size_y(s) - 1) + window_copy_update_cursor(wme, data->cx, data->cy + 1); + } + if (scroll_only || data->cy == 0) { if (norectsel) data->cx = data->lastcx; @@ -6179,6 +6185,7 @@ static void window_copy_cursor_down(struct window_mode_entry *wme, int scroll_only) { struct window_copy_mode_data *data = wme->data; + struct options *oo = wme->wp->window->options; struct screen *s = &data->screen; u_int ox, oy, px, py; int norectsel; @@ -6194,6 +6201,11 @@ window_copy_cursor_down(struct window_mode_entry *wme, int scroll_only) if (data->lineflag == LINE_SEL_RIGHT_LEFT && oy == data->endsely) window_copy_other_end(wme); + if (scroll_only && options_get_number(oo, "mode-keys") == MODEKEY_VI) { + if (data->cy > 0) + window_copy_update_cursor(wme, data->cx, data->cy - 1); + } + if (scroll_only || data->cy == screen_size_y(s) - 1) { if (norectsel) data->cx = data->lastcx;