Only reset termios when user triggers reset action rather than in reponse to reset escape code

Fixes #9126
This commit is contained in:
Kovid Goyal 2025-10-18 08:53:50 +05:30
parent 0780eef7b1
commit c2fb9f14b5
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 4 additions and 3 deletions

View file

@ -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

View file

@ -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)