summaryrefslogtreecommitdiffstats
path: root/cmd-copy-mode.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2010-08-11 07:41:05 +0000
committerNicholas Marriott <nicm@openbsd.org>2010-08-11 07:41:05 +0000
commitae70071494a297a8a37518baadaabaf0bd44775b (patch)
treea1bd6840a1f461ee91826fd5ee7babe19d1b4327 /cmd-copy-mode.c
parent399988690149acc84d0d971cf632e1be12341a8c (diff)
Handle failure to change mode, to avoid dying when switching into copy
mode when already in a different mode. Reported by "Florian".
Diffstat (limited to 'cmd-copy-mode.c')
-rw-r--r--cmd-copy-mode.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/cmd-copy-mode.c b/cmd-copy-mode.c
index 714ec35f..3e858a33 100644
--- a/cmd-copy-mode.c
+++ b/cmd-copy-mode.c
@@ -62,7 +62,8 @@ cmd_copy_mode_exec(struct cmd *self, struct cmd_ctx *ctx)
if (cmd_find_pane(ctx, data->target, NULL, &wp) == NULL)
return (-1);
- window_pane_set_mode(wp, &window_copy_mode);
+ if (window_pane_set_mode(wp, &window_copy_mode) != 0)
+ return (0);
window_copy_init_from_pane(wp);
if (wp->mode == &window_copy_mode && cmd_check_flag(data->chflags, 'u'))
window_copy_pageup(wp);