From 7021757c9d74eda8a5c1d7940b0d33bbad41fd29 Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 16 Mar 2020 14:17:56 +0000 Subject: [PATCH] Adjust selection correctly when scrolling, from Anindya Mukherjee. --- window-copy.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/window-copy.c b/window-copy.c index 76cea4e6..6864d8f9 100644 --- a/window-copy.c +++ b/window-copy.c @@ -2877,15 +2877,15 @@ window_copy_redraw_screen(struct window_mode_entry *wme) } static void -window_copy_synchronize_cursor_end(struct window_mode_entry *wme) +window_copy_synchronize_cursor_end(struct window_mode_entry *wme, int begin) { struct window_copy_mode_data *data = wme->data; u_int xx, yy; - int begin = 0; yy = screen_hsize(data->backing) + data->cy - data->oy; switch (data->selflag) { case SEL_WORD: + begin = 0; xx = data->cx; if (data->ws == NULL) break; @@ -2911,6 +2911,7 @@ window_copy_synchronize_cursor_end(struct window_mode_entry *wme) } break; case SEL_LINE: + begin = 0; if (data->dy > yy) { /* Right to left selection. */ xx = 0; @@ -2948,11 +2949,10 @@ window_copy_synchronize_cursor(struct window_mode_entry *wme) switch (data->cursordrag) { case CURSORDRAG_ENDSEL: - window_copy_synchronize_cursor_end(wme); + window_copy_synchronize_cursor_end(wme, 0); break; case CURSORDRAG_SEL: - data->selx = data->cx; - data->sely = screen_hsize(data->backing) + data->cy - data->oy; + window_copy_synchronize_cursor_end(wme, 1); break; case CURSORDRAG_NONE: break;