about summary refs log tree commit diff stats
path: root/text_tests.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-08-10 22:56:10 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-08-10 22:56:10 -0700
commitda34fabf729e7cf51f4af2c499105350104bd525 (patch)
tree8fd9e86a4dcc2a27ee85e406cbcbfcc64fd3d813 /text_tests.lua
parentba48aadaa71ac01db2a9d9bd06a26dec30fd31b3 (diff)
downloadlines.love-da34fabf729e7cf51f4af2c499105350104bd525.tar.gz
bugfix: pagedown was sometimes bouncing up
Diffstat (limited to 'text_tests.lua')
-rw-r--r--text_tests.lua17
1 files changed, 17 insertions, 0 deletions
diff --git a/text_tests.lua b/text_tests.lua
index 9983e2d..e5e7823 100644
--- a/text_tests.lua
+++ b/text_tests.lua
@@ -1084,6 +1084,23 @@ function test_pagedown_can_start_from_middle_of_long_wrapping_line()
   App.screen.check(y, 'mno ', 'F - test_pagedown_can_start_from_middle_of_long_wrapping_line/screen:3')
 end
 
+function test_pagedown_never_moves_up()
+  io.write('\ntest_pagedown_never_moves_up')
+  -- draw the final screen line of a wrapping line
+  App.screen.init{width=Editor_state.left+30, height=60}
+  Editor_state = edit.initialize_test_state()
+  Editor_state.lines = load_array{'abc def ghi'}
+  Text.redraw_all(Editor_state)
+  Editor_state.cursor1 = {line=1, pos=9}
+  Editor_state.screen_top1 = {line=1, pos=9}
+  Editor_state.screen_bottom1 = {}
+  edit.draw(Editor_state)
+  -- pagedown makes no change
+  edit.run_after_keychord(Editor_state, 'pagedown')
+  check_eq(Editor_state.screen_top1.line, 1, 'F - test_pagedown_never_moves_up/screen_top:line')
+  check_eq(Editor_state.screen_top1.pos, 9, 'F - test_pagedown_never_moves_up/screen_top:pos')
+end
+
 function test_down_arrow_moves_cursor()
   io.write('\ntest_down_arrow_moves_cursor')
   App.screen.init{width=120, height=60}