about summary refs log tree commit diff stats
path: root/select.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2024-06-11 12:28:45 -0700
committerKartik K. Agaram <vc@akkartik.com>2024-06-11 12:28:45 -0700
commit6ed97fbd947506806d5aa64d574d2621b6ae5bee (patch)
tree0377fdfdab737c1c145cfe0ab2adf87cbae7017f /select.lua
parentcbf12ee3b89b12a76b9ed7b889a67b4ab7177dbc (diff)
parent262c078133e1603aa30b3404f4f4b12428d925e5 (diff)
downloadview.love-6ed97fbd947506806d5aa64d574d2621b6ae5bee.tar.gz
Merge text.love
Diffstat (limited to 'select.lua')
-rw-r--r--select.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/select.lua b/select.lua
index 79eeb82..2d0851a 100644
--- a/select.lua
+++ b/select.lua
@@ -69,7 +69,7 @@ end
 
 function Text.mouse_pos(State)
   local x,y = App.mouse_x(), App.mouse_y()
-  if y < State.line_cache[State.screen_top1.line].starty then
+  if y < State.top then
     return State.screen_top1.line, State.screen_top1.pos
   end
   for line_index,line in ipairs(State.lines) do
@@ -77,7 +77,8 @@ function Text.mouse_pos(State)
       return line_index, Text.to_pos_on_line(State, line_index, x,y)
     end
   end
-  return State.screen_bottom1.line, Text.pos_at_end_of_screen_line(State, State.screen_bottom1)
+  local screen_bottom1 = Text.screen_bottom1(State)
+  return screen_bottom1.line, Text.pos_at_end_of_screen_line(State, screen_bottom1)
 end
 
 function Text.selection(State)