diff options
author | Thomas Adam <thomas@xteddy.org> | 2020-02-13 10:01:27 +0000 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2020-02-13 10:01:27 +0000 |
commit | 6c28d0dd064da5b4f50814df30df95d76025b9df (patch) | |
tree | 662e91c39fb34250caaa948486117feeb4df9101 | |
parent | a4d8437bc2de38667a85e68f208dace0938baf07 (diff) | |
parent | f48b041cf22a55bbd9f6e1ab498cf610fdfc1a5f (diff) |
Merge branch 'obsd-master'
-rw-r--r-- | window-copy.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/window-copy.c b/window-copy.c index 6e80daad..a717884c 100644 --- a/window-copy.c +++ b/window-copy.c @@ -1521,14 +1521,26 @@ window_copy_cmd_select_word(struct window_copy_cmd_state *cs) struct session *s = cs->s; struct window_copy_mode_data *data = wme->data; const char *ws; + u_int px, py, xx; data->lineflag = LINE_SEL_LEFT_RIGHT; data->rectflag = 0; + px = data->cx; + py = screen_hsize(data->backing) + data->cy - data->oy; + xx = window_copy_find_length(wme, py); + ws = options_get_string(s->options, "word-separators"); window_copy_cursor_previous_word(wme, ws, 0); window_copy_start_selection(wme); - window_copy_cursor_next_word_end(wme, ws); + + if (px >= xx || !window_copy_in_set(wme, px + 1, py, ws)) + window_copy_cursor_next_word_end(wme, ws); + else { + window_copy_update_cursor(wme, px, data->cy); + if (window_copy_update_selection(wme, 1)) + window_copy_redraw_lines(wme, data->cy, 1); + } return (WINDOW_COPY_CMD_REDRAW); } |