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
This commit is contained in:
parent
e2e701460b
commit
c9252e8639
@ -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);
|
||||
|
||||
@ -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):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user