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:
Nicholas Marriott 2010-08-11 07:41:05 +00:00
parent 3999886901
commit ae70071494

View File

@ -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);