Sync OpenBSD patchset 748:

Handle failure to change mode, to avoid dying when switching into copy
mode when already in a different mode. Reported by "Florian".
This commit is contained in:
Tiago Cunha 2010-08-11 22:18:28 +00:00
parent b0169d9b84
commit 9858071dd0

View File

@ -1,4 +1,4 @@
/* $Id: cmd-copy-mode.c,v 1.27 2010-04-05 05:11:42 micahcowan Exp $ */ /* $Id: cmd-copy-mode.c,v 1.28 2010-08-11 22:18:28 tcunha Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -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) if (cmd_find_pane(ctx, data->target, NULL, &wp) == NULL)
return (-1); 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); window_copy_init_from_pane(wp);
if (wp->mode == &window_copy_mode && cmd_check_flag(data->chflags, 'u')) if (wp->mode == &window_copy_mode && cmd_check_flag(data->chflags, 'u'))
window_copy_pageup(wp); window_copy_pageup(wp);