summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2009-06-29 07:11:21 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2009-06-29 07:11:21 +0000
commita3bdfc77dd3683500dd9b0f722e6683a8482454f (patch)
treef28403f5050d72d9c9be0a5838a3acd69f3331a9 /usr.bin
parent9dd9095c781c4a8a468c49a34e167296307564b5 (diff)
Don't try to page up with scroll-mode -u or copy-mode -u unless the mode was
successfully changed - if already in a different mode, it would corrupt the mode data.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/cmd-copy-mode.c10
-rw-r--r--usr.bin/tmux/cmd-scroll-mode.c10
2 files changed, 12 insertions, 8 deletions
diff --git a/usr.bin/tmux/cmd-copy-mode.c b/usr.bin/tmux/cmd-copy-mode.c
index f1121d5ac86..bba05e3a591 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.1 2009/06/01 22:58:49 nicm Exp $ */
+/* $OpenBSD: cmd-copy-mode.c,v 1.2 2009/06/29 07:11:20 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -44,13 +44,15 @@ cmd_copy_mode_exec(struct cmd *self, struct cmd_ctx *ctx)
{
struct cmd_target_data *data = self->data;
struct winlink *wl;
+ struct window_pane *wp;
if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
return (-1);
+ wp = wl->window->active;
- window_pane_set_mode(wl->window->active, &window_copy_mode);
- if (data->flags & CMD_UFLAG)
- window_copy_pageup(wl->window->active);
+ window_pane_set_mode(wp, &window_copy_mode);
+ if (wp->mode == &window_copy_mode && data->flags & CMD_UFLAG)
+ window_copy_pageup(wp);
return (0);
}
diff --git a/usr.bin/tmux/cmd-scroll-mode.c b/usr.bin/tmux/cmd-scroll-mode.c
index 2bbf6e864d0..bb156a7f6f3 100644
--- a/usr.bin/tmux/cmd-scroll-mode.c
+++ b/usr.bin/tmux/cmd-scroll-mode.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-scroll-mode.c,v 1.1 2009/06/01 22:58:49 nicm Exp $ */
+/* $OpenBSD: cmd-scroll-mode.c,v 1.2 2009/06/29 07:11:20 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -60,13 +60,15 @@ cmd_scroll_mode_exec(struct cmd *self, struct cmd_ctx *ctx)
{
struct cmd_target_data *data = self->data;
struct winlink *wl;
+ struct window_pane *wp;
if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
return (-1);
+ wp = wl->window->active;
- window_pane_set_mode(wl->window->active, &window_scroll_mode);
- if (data->flags & CMD_UFLAG)
- window_scroll_pageup(wl->window->active);
+ window_pane_set_mode(wp, &window_scroll_mode);
+ if (wp->mode == &window_scroll_mode && data->flags & CMD_UFLAG)
+ window_scroll_pageup(wp);
return (0);
}