From c2fb9f14b5ef1dec43d0d023698ea867a44863e2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 18 Oct 2025 08:53:50 +0530 Subject: [PATCH] Only reset termios when user triggers reset action rather than in reponse to reset escape code Fixes #9126 --- kitty/child.py | 4 ++-- kitty/window.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/kitty/child.py b/kitty/child.py index f8fd0a5a8..ed3da1f37 100644 --- a/kitty/child.py +++ b/kitty/child.py @@ -563,9 +563,9 @@ class Child: os.killpg(pgrp, s) return True - def reset_termios_state(self) -> None: + def reset_termios_state(self, when: int = termios.TCSANOW) -> None: if (s := getattr(self, 'initial_termios_state', None)) and self.child_fd is not None: try: - termios.tcsetattr(self.child_fd, termios.TCSANOW, s) + termios.tcsetattr(self.child_fd, when, s) except OSError: pass diff --git a/kitty/window.py b/kitty/window.py index 5eeb64982..3c4e92b78 100644 --- a/kitty/window.py +++ b/kitty/window.py @@ -1334,7 +1334,7 @@ class Window: self.screen.send_escape_code_to_child(ESC_OSC, f'{code};rgb:{r:04x}/{g:04x}/{b:04x}') def on_reset(self) -> None: - self.child.reset_termios_state() + pass def notify_child_of_resize(self) -> None: pty_size = self.last_reported_pty_size @@ -1918,6 +1918,7 @@ class Window: self.screen.cursor.x = self.screen.cursor.y = 0 if reset: self.screen.reset() + self.child.reset_termios_state() else: self.screen.erase_in_display(3 if scrollback else 2, False)