mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 09:26:05 +00:00 
			
		
		
		
	Sync OpenBSD patchset 1051:
Add a helper function for enabling an optimization to make some code clearer.
This commit is contained in:
		
							
								
								
									
										21
									
								
								tty.c
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								tty.c
									
									
									
									
									
								
							@@ -501,6 +501,19 @@ tty_emulate_repeat(
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Is the region large enough to be worth redrawing once later rather than
 | 
			
		||||
 * probably several times now? Currently yes if it is more than 50% of the
 | 
			
		||||
 * pane.
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
tty_large_region(unused struct tty *tty, const struct tty_ctx *ctx)
 | 
			
		||||
{
 | 
			
		||||
	struct window_pane	*wp = ctx->wp;
 | 
			
		||||
 | 
			
		||||
	return (ctx->orlower - ctx->orupper >= screen_size_y(wp->screen) / 2);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Redraw scroll region using data from screen (already updated). Used when
 | 
			
		||||
 * CSR not supported, or window is a pane that doesn't take up the full
 | 
			
		||||
@@ -514,12 +527,10 @@ tty_redraw_region(struct tty *tty, const struct tty_ctx *ctx)
 | 
			
		||||
	u_int		 	 i;
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * If region is >= 50% of the screen, just schedule a window redraw. In
 | 
			
		||||
	 * most cases, this is likely to be followed by some more scrolling -
 | 
			
		||||
	 * without this, the entire pane ends up being redrawn many times which
 | 
			
		||||
	 * can be much more data.
 | 
			
		||||
	 * If region is large, schedule a window redraw. In most cases this is
 | 
			
		||||
	 * likely to be followed by some more scrolling.
 | 
			
		||||
	 */
 | 
			
		||||
	if (ctx->orlower - ctx->orupper >= screen_size_y(s) / 2) {
 | 
			
		||||
	if (tty_large_region(tty, ctx)) {
 | 
			
		||||
		wp->flags |= PANE_REDRAW;
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user