From a2bad801d23732753acceb174162eaf7bed39b04 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Thu, 25 Mar 2021 08:39:44 -0700 Subject: [PATCH] don't rewrap the alt screen on resize It is only used by applications that repaint on a resize event, and us rewrapping makes it harder to have an ideal view afterwards. This change makes us more consistent with VTE's behavior in this case. This helps with https://github.com/wez/wezterm/issues/574 but doesn't completely resolve it. --- term/src/screen.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/term/src/screen.rs b/term/src/screen.rs index 3ce128868..33d25cb6a 100644 --- a/term/src/screen.rs +++ b/term/src/screen.rs @@ -27,6 +27,9 @@ pub struct Screen { /// config so we can access Maximum number of lines of scrollback config: Arc, + + /// Whether scrollback is allowed; this is another way of saying + /// that we're the primary rather than the alternate screen. allow_scrollback: bool, /// Physical, visible height of the screen (not including scrollback) @@ -172,11 +175,14 @@ impl Screen { } } - let (cursor_x, cursor_y) = if physical_cols != self.physical_cols { + let (cursor_x, cursor_y) = if self.allow_scrollback && physical_cols != self.physical_cols { // Check to see if we need to rewrap lines that were // wrapped due to reaching the right hand side of the terminal. // For each one that we find, we need to join it with its - // successor and then re-split it + // successor and then re-split it. + // We only do this for the primary, and not for the alternate + // screen (hence the check for allow_scrollback), to avoid + // conflicting screen updates with full screen apps. self.rewrap_lines(physical_cols, physical_rows, cursor.x, cursor_phys) } else { (cursor.x, cursor_phys)