Ensure PageUp and PageDown go to beginning of line
This commit is contained in:
@@ -464,7 +464,7 @@ class File:
|
||||
else:
|
||||
pos = max(self.file_y - margin.page_size, 0)
|
||||
self.y = self.file_y = pos
|
||||
self._set_x_after_vertical_movement()
|
||||
self.x = self.x_hint = 0
|
||||
|
||||
@action
|
||||
def page_down(self, margin: Margin) -> None:
|
||||
@@ -473,7 +473,7 @@ class File:
|
||||
else:
|
||||
pos = self.file_y + margin.page_size
|
||||
self.y = self.file_y = pos
|
||||
self._set_x_after_vertical_movement()
|
||||
self.x = self.x_hint = 0
|
||||
|
||||
# editing
|
||||
|
||||
|
||||
@@ -88,6 +88,19 @@ def test_page_up_and_page_down(run, ten_lines, page_up, page_down):
|
||||
h.assert_cursor_line_equals('line_9')
|
||||
|
||||
|
||||
def test_page_up_and_page_down_x_0(run, ten_lines):
|
||||
with run(str(ten_lines), height=10) as h, and_exit(h):
|
||||
h.press('Right')
|
||||
h.press('PageDown')
|
||||
h.await_cursor_position(x=0, y=1)
|
||||
h.assert_cursor_line_equals('line_6')
|
||||
|
||||
h.press('Right')
|
||||
h.press('PageUp')
|
||||
h.await_cursor_position(x=0, y=1)
|
||||
h.assert_cursor_line_equals('line_0')
|
||||
|
||||
|
||||
def test_page_up_page_down_size_small_window(run, ten_lines):
|
||||
with run(str(ten_lines), height=4) as h, and_exit(h):
|
||||
h.press('PageDown')
|
||||
|
||||
Reference in New Issue
Block a user