diff --git a/tools/cmd/at/tty_io.go b/tools/cmd/at/tty_io.go index d64a8dc61..ba352bf21 100644 --- a/tools/cmd/at/tty_io.go +++ b/tools/cmd/at/tty_io.go @@ -30,8 +30,8 @@ func do_chunked_io(io_data *rc_io_data) (serialized_response []byte, err error) // we cant do inbandresize notification as in the --no-response case the // command can cause a resize and the loop can quit before the notification // arrives, leading to the notification being sent to whatever is executed - // after us. - lp, err := loop.New(loop.NoAlternateScreen, loop.NoRestoreColors, loop.NoInBandResizeNotifications) + // after us. Similarly no focus tracking. + lp, err := loop.New(loop.NoAlternateScreen, loop.NoRestoreColors, loop.NoInBandResizeNotifications, loop.NoFocusTracking) if io_data.on_key_event != nil { lp.FullKeyboardProtocol() } else { diff --git a/tools/tui/loop/api.go b/tools/tui/loop/api.go index 6fa0bb606..d4b1fe222 100644 --- a/tools/tui/loop/api.go +++ b/tools/tui/loop/api.go @@ -209,6 +209,15 @@ func NoRestoreColors(self *Loop) { self.terminal_options.restore_colors = false } +func (self *Loop) NoFocusTracking() *Loop { + self.terminal_options.focus_tracking = false + return self +} + +func NoFocusTracking(self *Loop) { + self.terminal_options.focus_tracking = false +} + func (self *Loop) ColorSchemeChangeNotifications() *Loop { self.terminal_options.color_scheme_change_notification = true return self diff --git a/tools/tui/loop/run.go b/tools/tui/loop/run.go index d2a53e813..673d108b6 100644 --- a/tools/tui/loop/run.go +++ b/tools/tui/loop/run.go @@ -26,6 +26,7 @@ func new_loop() *Loop { l := Loop{controlling_term: nil} l.terminal_options.Alternate_screen = true l.terminal_options.restore_colors = true + l.terminal_options.focus_tracking = true l.terminal_options.in_band_resize_notification = true l.terminal_options.color_scheme_change_notification = false l.terminal_options.kitty_keyboard_mode = DISAMBIGUATE_KEYS | REPORT_ALTERNATE_KEYS | REPORT_ALL_KEYS_AS_ESCAPE_CODES | REPORT_TEXT_WITH_KEYS diff --git a/tools/tui/loop/terminal-state.go b/tools/tui/loop/terminal-state.go index 7d6468b10..daa62e7b0 100644 --- a/tools/tui/loop/terminal-state.go +++ b/tools/tui/loop/terminal-state.go @@ -102,6 +102,7 @@ type TerminalStateOptions struct { mouse_tracking MouseTracking kitty_keyboard_mode KeyboardStateBits in_band_resize_notification bool + focus_tracking bool color_scheme_change_notification bool } @@ -131,7 +132,10 @@ func (self *TerminalStateOptions) SetStateEscapeCodes() string { reset_modes(&sb, IRM, DECKM, DECSCNM, BRACKETED_PASTE, MOUSE_BUTTON_TRACKING, MOUSE_MOTION_TRACKING, MOUSE_MOVE_TRACKING, MOUSE_UTF8_MODE, MOUSE_SGR_MODE) - set_modes(&sb, DECARM, DECAWM, DECTCEM, FOCUS_TRACKING) + set_modes(&sb, DECARM, DECAWM, DECTCEM) + if self.focus_tracking { + set_modes(&sb, FOCUS_TRACKING) + } if self.in_band_resize_notification { set_modes(&sb, INBAND_RESIZE_NOTIFICATION) }