From 9a55f65702b5d32e0127c78ea9762c7bb47e3477 Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 20 Mar 2020 20:12:39 +0000 Subject: [PATCH] Fix select-word when not on a word, from Anindya Mukherjee. --- window-copy.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/window-copy.c b/window-copy.c index 9fe4fcef..53faa5a8 100644 --- a/window-copy.c +++ b/window-copy.c @@ -1590,13 +1590,12 @@ window_copy_cmd_select_word(struct window_copy_cmd_state *cs) data->dx = data->cx; data->dy = screen_hsize(data->backing) + data->cy - data->oy; - px = data->cx; - py = screen_hsize(data->backing) + data->cy - data->oy; - data->ws = options_get_string(s->options, "word-separators"); window_copy_cursor_previous_word(wme, data->ws, 0); - data->selrx = data->cx; - data->selry = screen_hsize(data->backing) + data->cy - data->oy; + px = data->cx; + py = screen_hsize(data->backing) + data->cy - data->oy; + data->selrx = px; + data->selry = py; window_copy_start_selection(wme); if (px >= window_copy_find_length(wme, py) || @@ -1609,6 +1608,8 @@ window_copy_cmd_select_word(struct window_copy_cmd_state *cs) } data->endselrx = data->cx; data->endselry = screen_hsize(data->backing) + data->cy - data->oy; + if (data->dx > data->endselrx) + data->dx = data->endselrx; return (WINDOW_COPY_CMD_REDRAW); }