about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-07-08 16:24:10 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-07-08 16:24:10 -0700
commit532b8dddd79b8f9e7210893c1fbe8318cb4daa6f (patch)
tree8df818b631efea189345e19bba3d1387ddd4d235
parent3eb89adca6ffa6157236425458d64a735a1d2fa1 (diff)
downloadview.love-532b8dddd79b8f9e7210893c1fbe8318cb4daa6f.tar.gz
add args to some functions
  - Text.previous_screen_line
-rw-r--r--text.lua10
1 files changed, 5 insertions, 5 deletions
diff --git a/text.lua b/text.lua
index 8d30faa..8c95da3 100644
--- a/text.lua
+++ b/text.lua
@@ -215,7 +215,7 @@ function Text.keychord_pressed(chord)
     end
     if Text.lt1(Cursor1, Screen_top1) then
       local top2 = Text.to2(Screen_top1)
-      top2 = Text.previous_screen_line(top2)
+      top2 = Text.previous_screen_line(top2, Margin_left, App.screen.width-Margin_right)
       Screen_top1 = Text.to1(top2)
       Text.redraw_all()  -- if we're scrolling, reclaim all fragments to avoid memory leaks
     end
@@ -367,7 +367,7 @@ function Text.pageup(left, right)
     elseif Lines[Screen_top1.line].mode == 'drawing' then
       y = y - Drawing_padding_height - Drawing.pixels(Lines[Screen_top1.line].h)
     end
-    top2 = Text.previous_screen_line(top2)
+    top2 = Text.previous_screen_line(top2, left, right)
   end
   Screen_top1 = Text.to1(top2)
   Cursor1.line = Screen_top1.line
@@ -558,7 +558,7 @@ function Text.left(left, right)
   end
   if Text.lt1(Cursor1, Screen_top1) then
     local top2 = Text.to2(Screen_top1)
-    top2 = Text.previous_screen_line(top2)
+    top2 = Text.previous_screen_line(top2, left, right)
     Screen_top1 = Text.to1(top2)
   end
 end
@@ -655,7 +655,7 @@ function Text.snap_cursor_to_bottom_of_screen(left, right)
 --?       print('skipping drawing of height', h)
       y = y - h
     end
-    top2 = Text.previous_screen_line(top2)
+    top2 = Text.previous_screen_line(top2, left, right)
   end
 --?   print('top2 finally:', top2.line, top2.screen_line, top2.screen_pos)
   Screen_top1 = Text.to1(top2)
@@ -879,7 +879,7 @@ function Text.offset(s, pos1)
   return result
 end
 
-function Text.previous_screen_line(pos2)
+function Text.previous_screen_line(pos2, left, right)
   if pos2.screen_line > 1 then
     return {line=pos2.line, screen_line=pos2.screen_line-1, screen_pos=1}
   elseif pos2.line == 1 then