about summary refs log tree commit diff stats
path: root/select.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2023-06-03 10:36:05 -0700
committerKartik K. Agaram <vc@akkartik.com>2023-06-03 10:36:05 -0700
commit3114176ebd5b9895b5f67c759a2a705f673a4ac0 (patch)
treef8a6a60a8cd0165f5aa7b70fea1c267f469fcca6 /select.lua
parent541519a9986fe5c85d6b03fc8cf993ba8e950b0c (diff)
downloadlines.love-3114176ebd5b9895b5f67c759a2a705f673a4ac0.tar.gz
change how we handle clicks above top margin
Diffstat (limited to 'select.lua')
-rw-r--r--select.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/select.lua b/select.lua
index dbd551b..c2fe7ad 100644
--- a/select.lua
+++ b/select.lua
@@ -74,6 +74,9 @@ function Text.mouse_pos(State)
 end
 
 function Text.to_pos(State, x,y)
+  if y < State.line_cache[State.screen_top1.line].starty then
+    return State.screen_top1.line, State.screen_top1.pos
+  end
   for line_index,line in ipairs(State.lines) do
     if line.mode == 'text' then
       if Text.in_line(State, line_index, x,y) then