about summary refs log tree commit diff stats
path: root/select.lua
diff options
context:
space:
mode:
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