summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/cmd-copy-mode.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2013-03-28 15:07:43 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2013-03-28 15:07:43 +0000
commitf336cbb6efef99434bc1f9de1daebfdf2687512c (patch)
treebbb5688965a3e7cc9e87059b801c996595838acf /usr.bin/tmux/cmd-copy-mode.c
parent074382f949295292cba8a708947bdfdd4cfb48c8 (diff)
Make copy-mode -u still scroll up if already in copy mode, handy for
people who bind it with -n.
Diffstat (limited to 'usr.bin/tmux/cmd-copy-mode.c')
-rw-r--r--usr.bin/tmux/cmd-copy-mode.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/tmux/cmd-copy-mode.c b/usr.bin/tmux/cmd-copy-mode.c
index 7bd82e3b1e0..2f5272f94e6 100644
--- a/usr.bin/tmux/cmd-copy-mode.c
+++ b/usr.bin/tmux/cmd-copy-mode.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-copy-mode.c,v 1.14 2013/03/24 09:54:10 nicm Exp $ */
+/* $OpenBSD: cmd-copy-mode.c,v 1.15 2013/03/28 15:07:42 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -54,9 +54,11 @@ cmd_copy_mode_exec(struct cmd *self, struct cmd_q *cmdq)
if (cmd_find_pane(cmdq, args_get(args, 't'), NULL, &wp) == NULL)
return (CMD_RETURN_ERROR);
- if (window_pane_set_mode(wp, &window_copy_mode) != 0)
- return (CMD_RETURN_NORMAL);
- window_copy_init_from_pane(wp);
+ if (wp->mode != &window_copy_mode) {
+ if (window_pane_set_mode(wp, &window_copy_mode) != 0)
+ return (CMD_RETURN_NORMAL);
+ window_copy_init_from_pane(wp);
+ }
if (wp->mode == &window_copy_mode && args_has(self->args, 'u'))
window_copy_pageup(wp);