mirror of
https://github.com/tmux/tmux.git
synced 2024-12-12 17:38:48 +00:00
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.
This commit is contained in:
parent
710393e388
commit
003e8e65f7
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user