summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/window-copy.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2013-07-12 09:52:37 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2013-07-12 09:52:37 +0000
commit0448d98351e3d81d1a8e0cfc68037a43ae655971 (patch)
tree755d4513c8e2cfdf0dcb577fd6aedf9067e058a4 /usr.bin/tmux/window-copy.c
parent224304824c945f86a3b89f0983febdf637ba194b (diff)
Make next-word-end work properly with vi(1) keys, reported by patrick
keshishian.
Diffstat (limited to 'usr.bin/tmux/window-copy.c')
-rw-r--r--usr.bin/tmux/window-copy.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c
index f0d1a760a01..a1505b0958e 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.93 2013/07/05 14:44:06 nicm Exp $ */
+/* $OpenBSD: window-copy.c,v 1.94 2013/07/12 09:52:36 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -1897,13 +1897,17 @@ window_copy_cursor_next_word_end(struct window_pane *wp, const char *separators)
struct options *oo = &wp->window->options;
struct screen *back_s = data->backing;
u_int px, py, xx, yy;
- int expected = 1;
+ int keys, expected = 1;
px = data->cx;
py = screen_hsize(back_s) + data->cy - data->oy;
xx = window_copy_find_length(wp, py);
yy = screen_hsize(back_s) + screen_size_y(back_s) - 1;
+ keys = options_get_number(oo, "mode-keys");
+ if (keys == MODEKEY_VI && !window_copy_in_set(wp, px, py, separators))
+ px++;
+
/*
* First skip past any word characters, then any nonword characters.
*
@@ -1928,8 +1932,7 @@ window_copy_cursor_next_word_end(struct window_pane *wp, const char *separators)
expected = !expected;
} while (expected == 0);
- /* Back up to the end-of-word like vi. */
- if (options_get_number(oo, "status-keys") == MODEKEY_VI && px != 0)
+ if (keys == MODEKEY_VI && px != 0)
px--;
window_copy_update_cursor(wp, px, data->cy);