Cleanup previous PR

This commit is contained in:
Kovid Goyal 2026-10-18 07:58:49 +05:30
parent e9bd5a93f8
commit c0b384f310
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
4 changed files with 32 additions and 15 deletions

View file

@ -231,7 +231,7 @@ Detailed list of changes
0.50.0 [future]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Fix cursor position reports returning the wrong row in origin mode
- Fix cursor position reports returning the wrong row in origin mode (:pull:`10682`)
- macOS: A new option :opt:`restore_session_after_logout` to save the state of
every kitty instance, including the scrollback of every window, encrypted with

View file

@ -3279,7 +3279,8 @@ report_device_status(Screen *self, unsigned int which, bool private) {
x = self->cursor->x;
y = self->cursor->y;
if (x >= self->columns) {
if (y < self->lines - 1) {
// A wrap at the bottom margin scrolls the region, leaving the cursor on the same row
if (y < self->lines - 1 && y != self->margin_bottom) {
x = 0;
y++;
} else x--;

View file

@ -1013,19 +1013,6 @@ class TestParser(BaseTest):
self.ae(c.wtcbuf, b'\x1b[?2033;1$y')
pb('\033[?2033l', ('screen_reset_mode', 2033, 1))
def test_cursor_position_report_origin_mode(self) -> None:
s = self.create_screen(cols=10, lines=10)
for top in (1, 3):
for origin in (False, True):
parse_bytes(s, f'\033[{top};8r\033[?6{"h" if origin else "l"}'.encode())
for row in (1, 4):
parse_bytes(s, f'\033[{row};5H'.encode())
for private in ('', '?'):
with self.subTest(top=top, origin=origin, row=row, private=private):
s.callbacks.clear()
parse_bytes(s, f'\033[{private}6n'.encode())
self.ae(s.callbacks.wtcbuf, f'\033[{private}{row};5R'.encode())
def test_malformed_csi_subparam_does_not_corrupt_sgr(self):
# Regression for #10434: \e[?:m sets is_sub_param[0]=true in the CSI
# state. reset_csi must clear that flag so the next SGR isn't rejected.

View file

@ -647,6 +647,35 @@ class TestScreen(BaseTest):
parse_bytes(s, b'\x1b[?2033l\x1b[?2033$p') # ]]
self.ae(c.wtcbuf, b'\x1b[?2033;2$y') # ]
def test_cursor_position_report_origin_mode(self):
s = self.create_screen(cols=10, lines=10)
def report(private=''):
s.callbacks.clear()
parse_bytes(s, f'\x1b[{private}6n'.encode()) # ]
return s.callbacks.wtcbuf.decode()
for top in (1, 3):
for origin in (False, True):
parse_bytes(s, f'\x1b[{top};8r\x1b[?6{"h" if origin else "l"}'.encode()) # ]]
for row in (1, 4):
parse_bytes(s, f'\x1b[{row};5H'.encode()) # ]
for private in ('', '?'):
with self.subTest(top=top, origin=origin, row=row, private=private):
self.ae(report(private), f'\x1b[{private}{row};5R') # ]
# cursor addressing is clamped to the bottom margin in origin mode
parse_bytes(s, b'\x1b[3;8r\x1b[?6h\x1b[99;5H') # ]]]
self.ae(report(), '\x1b[6;5R') # ]
# pending wrap at the bottom margin stays on the same row
parse_bytes(s, b'\x1b[6;10Hx') # ]
self.ae(report(), '\x1b[6;10R') # ]
# pending wrap inside the region moves to the start of the next row
parse_bytes(s, b'\x1b[2;10Hx') # ]
self.ae(report(), '\x1b[3;1R') # ]
# pending wrap at the bottom of the screen outside the region
parse_bytes(s, b'\x1b[?6l\x1b[10;10Hx') # ]]
self.ae(report(), '\x1b[10;10R') # ]
def test_da1(self):
s = self.create_screen()
parse_bytes(s, b'\x1b[c\x1b[0c') # ]]