From 89138cf7e3f44524b38ddbab88d3d30f2a0dffce Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 1 Mar 2023 17:09:57 -0800 Subject: [PATCH] screen: don't trim blank lines if rows aren't changing --- src/terminal/Screen.zig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/terminal/Screen.zig b/src/terminal/Screen.zig index 7707863fc..7165749f3 100644 --- a/src/terminal/Screen.zig +++ b/src/terminal/Screen.zig @@ -1718,6 +1718,10 @@ pub fn resizeWithoutReflow(self: *Screen, rows: usize, cols: usize) !void { // between terminal apps. I'm completely open to changing it as long // as resize behavior isn't regressed in a user-hostile way. const trailing_blank_lines = blank: { + // If we aren't changing row length, then don't bother calculating + // because we aren't going to trim. + if (self.rows == rows) break :blank 0; + // If there is history, blank line counting is disabled and // we generate scrollback. Why? Terminal.app does it, seems... fine. if (self.history > 0) break :blank 0;