summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/window-copy.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2013-07-05 14:41:37 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2013-07-05 14:41:37 +0000
commitc9e22452c3dd03d1ed1c3bd11fba4640d19a9bb9 (patch)
tree9ac80b5067d29a2888955265e92adf77f9238136 /usr.bin/tmux/window-copy.c
parente6ece1d0d6cbc454ca3e8451999c833cce8fbfce (diff)
Act like vi(1) when moving words, from Ben Boeckel.
Diffstat (limited to 'usr.bin/tmux/window-copy.c')
-rw-r--r--usr.bin/tmux/window-copy.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c
index c098a0df037..0537de18bac 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.91 2013/03/25 11:43:33 nicm Exp $ */
+/* $OpenBSD: window-copy.c,v 1.92 2013/07/05 14:41:36 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -1894,6 +1894,7 @@ void
window_copy_cursor_next_word_end(struct window_pane *wp, const char *separators)
{
struct window_copy_mode_data *data = wp->modedata;
+ struct options *oo = &wp->window->options;
struct screen *back_s = data->backing;
u_int px, py, xx, yy;
int expected = 1;
@@ -1927,6 +1928,10 @@ 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)
+ px--;
+
window_copy_update_cursor(wp, px, data->cy);
if (window_copy_update_selection(wp))
window_copy_redraw_lines(wp, data->cy, 1);