mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 01:34:18 +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:
		@@ -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>
 | 
			
		||||
@@ -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);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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>
 | 
			
		||||
@@ -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);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user