Fix cursor position at x=0 changing to x=1 on resize

Fixes #5635
This commit is contained in:
Kovid Goyal
2022-10-31 08:03:42 +05:30
parent e0b4c7edc5
commit 16b322616a
4 changed files with 15 additions and 2 deletions

View File

@@ -332,6 +332,17 @@ class TestScreen(BaseTest):
s.resize(s.lines - 1, s.columns)
self.ae(x_before, s.cursor.x)
def test_cursor_position_after_resize(self):
# test x position remains the same after resize
s = self.create_screen()
s.draw('abc')
b = s.cursor.x
s.resize(7, s.columns)
self.assertEqual(s.cursor.x, b)
s.cursor.x = 0
s.resize(5, s.columns)
self.assertEqual(s.cursor.x, 0)
def test_scrollback_fill_after_resize(self):
def prepare_screen(content=()):
ans = self.create_screen(options={'scrollback_fill_enlarged_window': True})