From c9252e86397ef552eb51c601c22d90abec37cb3d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 29 Jun 2020 14:29:03 +0530 Subject: [PATCH] When erasing in display upto cursor, the line containing the cursor should be marked as not continued. Also add some tests for the action of ED on continued flags --- kitty/screen.c | 1 + kitty_tests/screen.py | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/kitty/screen.c b/kitty/screen.c index 36fb9a52b..70faf3c98 100644 --- a/kitty/screen.c +++ b/kitty/screen.c @@ -1195,6 +1195,7 @@ screen_erase_in_display(Screen *self, unsigned int how, bool private) { } if (how != 2) { screen_erase_in_line(self, how, private); + if (how == 1) linebuf_mark_line_as_not_continued(self->linebuf, self->cursor->y); } if (how == 3 && self->linebuf == self->main_linebuf) { historybuf_clear(self->historybuf); diff --git a/kitty_tests/screen.py b/kitty_tests/screen.py index 8a6072980..82dd7d563 100644 --- a/kitty_tests/screen.py +++ b/kitty_tests/screen.py @@ -176,21 +176,29 @@ class TestScreen(BaseTest): def all_lines(s): return tuple(str(s.line(i)) for i in range(s.lines)) + def continuations(s): + return tuple(s.line(i).is_continued() for i in range(s.lines)) + init() - s.erase_in_display() + s.erase_in_display(0) self.ae(all_lines(s), ('12345', '12', '', '', '')) + self.ae(continuations(s), (False, True, False, False, False)) init() s.erase_in_display(1) self.ae(all_lines(s), ('', ' 45', '12345', '12345', '12345')) + self.ae(continuations(s), (False, False, True, True, True)) init() s.erase_in_display(2) self.ae(all_lines(s), ('', '', '', '', '')) self.assertTrue(s.line(0).cursor_from(1).bold) + self.ae(continuations(s), (False, False, False, False, False)) + init() s.erase_in_display(2, True) self.ae(all_lines(s), ('', '', '', '', '')) + self.ae(continuations(s), (False, False, False, False, False)) self.assertFalse(s.line(0).cursor_from(1).bold) def test_cursor_movement(self):