about summary refs log tree commit diff stats
path: root/main.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-05-23 08:52:13 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-05-23 08:52:13 -0700
commit4f6a324975b66a4939dc4a4e66cc65871397a867 (patch)
treeab93caf79a684dc19e231416d67b51795ec2eb19 /main.lua
parent37f1313b16971200f56552dbbf8c2b0b2b65417e (diff)
downloadlines.love-4f6a324975b66a4939dc4a4e66cc65871397a867.tar.gz
bugfix: don't rely on Screen_bottom1 while scrolling
Setting up the test just right to test the thing I want to test was a
rube goldberg machine of constants.
Diffstat (limited to 'main.lua')
-rw-r--r--main.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/main.lua b/main.lua
index e72a875..ca69be6 100644
--- a/main.lua
+++ b/main.lua
@@ -122,8 +122,10 @@ function App.draw()
   local y = 15
   if Debug_main then print('== draw') end
   for line_index,line in ipairs(Lines) do
+    print(y, line_index, line)
     if Debug_main then print('draw:', line_index, y) end
     if y + math.floor(15*Zoom) > App.screen.height then break end
+    print('a')
     if line_index >= Screen_top1.line then
       Screen_bottom1.line = line_index
       if line.mode == 'text' and line.data == '' then
@@ -226,12 +228,13 @@ function App.keychord_pressed(chord)
     end
     save_to_disk(Lines, Filename)
   elseif chord == 'pagedown' then
-    print('setting top to', Screen_bottom1.line)
     Screen_top1.line = Screen_bottom1.line
     Screen_top1.pos = Screen_bottom1.pos
+    print('setting top to', Screen_top1.line)
     Cursor1.line = Screen_top1.line
     Cursor1.pos = Screen_top1.pos
     Text.move_cursor_down_to_next_text_line_while_scrolling_again_if_necessary()
+    print('top now', Screen_top1.line)
   elseif chord == 'pageup' then
     -- duplicate some logic from love.draw
     local y = App.screen.height