summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/tmux/window-copy.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c
index 57317a432d7..6e317cfb344 100644
--- a/usr.bin/tmux/window-copy.c
+++ b/usr.bin/tmux/window-copy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window-copy.c,v 1.256 2020/03/20 17:59:40 nicm Exp $ */
+/* $OpenBSD: window-copy.c,v 1.257 2020/03/20 20:12:39 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -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);
}