about summary refs log tree commit diff stats
path: root/text.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-05-20 21:30:49 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-05-20 21:30:59 -0700
commita3f72abbdeac2d251c4221f1cb42896587afd60b (patch)
tree1e23f45e6ccc9282945785c7e536c8cef468f90b /text.lua
parent6b91c0688ea9c63b865c2f8cf6578eef488aaad8 (diff)
downloadtext.love-a3f72abbdeac2d251c4221f1cb42896587afd60b.tar.gz
reduce ambitions a bit: page up/down need not start screen from the middle of a line
But we still have work to do for cursor up/down.
Diffstat (limited to 'text.lua')
-rw-r--r--text.lua10
1 files changed, 3 insertions, 7 deletions
diff --git a/text.lua b/text.lua
index 6aa2eba..c94d8ce 100644
--- a/text.lua
+++ b/text.lua
@@ -26,13 +26,6 @@ function Text.draw(line, line_width, line_index)
         y = y + math.floor(15*Zoom)
         if New_render then print('y', y) end
       end
-      if y > Screen_height then
-        if line.screen_line_starting_pos then
-          Bottom_screen_line_starting_pos = line.screen_line_starting_pos[#line.screen_line_starting_pos]
-        else
-          Bottom_screen_line_starting_pos = 1
-        end
-      end
       x = 25
       if line.screen_line_starting_pos == nil then
         line.screen_line_starting_pos = {1, pos}
@@ -294,8 +287,11 @@ function Text.keychord_pressed(chord)
         end
       end
       if Cursor_line > Screen_bottom_line then
+        print('screen top before:', Screen_top_line, Top_screen_line_starting_pos)
         Screen_top_line = Cursor_line
+        print('scroll up preserving cursor')
         Text.scroll_up_while_cursor_on_screen()
+        print('screen top after:', Screen_top_line, Top_screen_line_starting_pos)
       end
     else
       -- move down one screen line in current line