mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-23 08:47:47 +02:00
Change the flow of lines from the scroll region to the scrollback
There are two user-visible changes in here: 1. If a scroll region is set such that there is a bottom margin and no top margin, scrolling the region forward used to discard the top lines. Now those lines are appended to the scrollback. ```shell # Assuming a terminal window with 24 lines. printf '\033[H\033[J\033[3J\033[0;5r' && seq 100 ``` This command used to result in an empty scrollback. Now it contains the numbers 1-96. 2. If a scroll region is set such that there is a top margin and no bottom margin, scrolling the region forward used to append the top lines to the scrollback. Now these lines are discarded. ```shell # Assuming a terminal window with 24 lines. printf '\033[H\033[J\033[3J\033[2;24r' && seq 100 ``` This command used to populate scrollback with the numbers 2-78. Now the scrollback is empty. The numbers on the screen are the same as before: 1 and 79-100. Related issue: #3113.
This commit is contained in:
@@ -683,3 +683,37 @@ class TestScreen(BaseTest):
|
||||
self.ae(s.current_url_text(), '123abcxyz')
|
||||
self.ae('2', s.hyperlink_at(1, 3))
|
||||
self.ae(s.current_url_text(), 'Z Z')
|
||||
|
||||
def test_bottom_margin(self):
|
||||
return
|
||||
s = self.create_screen(cols=80, lines=6, scrollback=4)
|
||||
s.set_margins(0, 5)
|
||||
for i in range(8):
|
||||
s.draw(str(i))
|
||||
s.linefeed()
|
||||
s.carriage_return()
|
||||
|
||||
self.ae(str(s.linebuf), '4\n5\n6\n7\n\n')
|
||||
self.ae(str(s.historybuf), '3\n2\n1\n0')
|
||||
|
||||
def test_top_margin(self):
|
||||
s = self.create_screen(cols=80, lines=6, scrollback=4)
|
||||
s.set_margins(2, 6)
|
||||
for i in range(8):
|
||||
s.draw(str(i))
|
||||
s.linefeed()
|
||||
s.carriage_return()
|
||||
|
||||
self.ae(str(s.linebuf), '0\n4\n5\n6\n7\n')
|
||||
self.ae(str(s.historybuf), '')
|
||||
|
||||
def test_top_and_bottom_margin(self):
|
||||
s = self.create_screen(cols=80, lines=6, scrollback=4)
|
||||
s.set_margins(2, 5)
|
||||
for i in range(8):
|
||||
s.draw(str(i))
|
||||
s.linefeed()
|
||||
s.carriage_return()
|
||||
|
||||
self.ae(str(s.linebuf), '0\n5\n6\n7\n\n')
|
||||
self.ae(str(s.historybuf), '')
|
||||
|
||||
Reference in New Issue
Block a user