mirror of
https://github.com/tmux/tmux.git
synced 2025-01-12 11:18: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
18ebc99906
commit
503c6a3377
@ -1,4 +1,4 @@
|
|||||||
/* $Id: cmd-copy-mode.c,v 1.16 2009-02-25 21:56:46 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>
|
* 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 cmd_target_data *data = self->data;
|
||||||
struct winlink *wl;
|
struct winlink *wl;
|
||||||
|
struct window_pane *wp;
|
||||||
|
|
||||||
if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
|
if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
wp = wl->window->active;
|
||||||
|
|
||||||
window_pane_set_mode(wl->window->active, &window_copy_mode);
|
window_pane_set_mode(wp, &window_copy_mode);
|
||||||
if (data->flags & CMD_UFLAG)
|
if (wp->mode == &window_copy_mode && data->flags & CMD_UFLAG)
|
||||||
window_copy_pageup(wl->window->active);
|
window_copy_pageup(wp);
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: cmd-scroll-mode.c,v 1.16 2009-01-27 23:35:44 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>
|
* 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 cmd_target_data *data = self->data;
|
||||||
struct winlink *wl;
|
struct winlink *wl;
|
||||||
|
struct window_pane *wp;
|
||||||
|
|
||||||
if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
|
if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
wp = wl->window->active;
|
||||||
|
|
||||||
window_pane_set_mode(wl->window->active, &window_scroll_mode);
|
window_pane_set_mode(wp, &window_scroll_mode);
|
||||||
if (data->flags & CMD_UFLAG)
|
if (wp->mode == &window_scroll_mode && data->flags & CMD_UFLAG)
|
||||||
window_scroll_pageup(wl->window->active);
|
window_scroll_pageup(wp);
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user