From 4b354fbd30048e7366fe8af63346cd30b2c1be25 Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Mon, 18 Nov 2024 10:51:14 -0600 Subject: [PATCH] tui: explicitly turn off in-band resize mode Explicitly turn off in-band resize notifications if they were requested as part of the loop. Kitty implicitly resets this mode when `XTRESTORE` (`CSI ? r`) is seen, however some terminals implementing mode 2048 (eg foot and Ghostty) follow the xterm behavior of only restoring the state of explicitly passed modes. Some of the kittens have become very useful outside of just Kitty (`show-key`, for example). Add an explicit reset of mode 2048 to support the behavior of other terminal emulators. --- tools/tui/loop/terminal-state.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/tui/loop/terminal-state.go b/tools/tui/loop/terminal-state.go index 7014c5017c..bfb0c22510 100644 --- a/tools/tui/loop/terminal-state.go +++ b/tools/tui/loop/terminal-state.go @@ -169,6 +169,9 @@ func (self *TerminalStateOptions) ResetStateEscapeCodes() string { } else { sb.WriteString(SAVE_CURSOR) } + if self.in_band_resize_notification { + reset_modes(&sb, INBAND_RESIZE_NOTIFICATION) + } sb.WriteString(RESTORE_PRIVATE_MODE_VALUES) if self.restore_colors { sb.WriteString(RESTORE_COLORS)