Fix failing screen resize test

Take into account the index that now happens to ensure that
the cursor is on a new line.
This commit is contained in:
Kovid Goyal 2017-09-30 13:51:35 +05:30
parent e832524bfc
commit 5b24d51fcd
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 6 additions and 5 deletions

1
.gitignore vendored
View File

@ -9,3 +9,4 @@ linux-package
logo/*.iconset logo/*.iconset
test-launcher test-launcher
kitty-profile kitty-profile
dev

View File

@ -217,18 +217,18 @@ class TestScreen(BaseTest):
s = self.create_screen(scrollback=6) s = self.create_screen(scrollback=6)
s.draw(''.join([str(i) * s.columns for i in range(s.lines)])) s.draw(''.join([str(i) * s.columns for i in range(s.lines)]))
s.resize(3, 10) s.resize(3, 10)
self.ae(str(s.line(0)), '0'*5 + '1'*5) self.ae(str(s.line(0)), '2'*5 + '3'*5)
self.ae(str(s.line(1)), '2'*5 + '3'*5) self.ae(str(s.line(1)), '4'*5)
self.ae(str(s.line(2)), '4'*5) self.ae(str(s.line(2)), ''*5)
s.resize(5, 1) s.resize(5, 1)
self.ae(str(s.line(0)), '4') self.ae(str(s.line(0)), '4')
hb = s.historybuf hb = s.historybuf
self.ae(str(hb), '3\n3\n3\n3\n3\n2') self.ae(str(hb), '4\n3\n3\n3\n3\n3')
s = self.create_screen(scrollback=20) s = self.create_screen(scrollback=20)
s.draw(''.join(str(i) * s.columns for i in range(s.lines*2))) s.draw(''.join(str(i) * s.columns for i in range(s.lines*2)))
self.ae(str(s.linebuf), '55555\n66666\n77777\n88888\n99999') self.ae(str(s.linebuf), '55555\n66666\n77777\n88888\n99999')
s.resize(5, 2) s.resize(5, 2)
self.ae(str(s.linebuf), '88\n88\n99\n99\n9') self.ae(str(s.linebuf), '88\n99\n99\n9\n')
def test_cursor_after_resize(self): def test_cursor_after_resize(self):
s = self.create_screen() s = self.create_screen()