about summary refs log tree commit diff stats
path: root/text.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-07-17 22:15:49 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-07-17 22:29:37 -0700
commit82cdd9ddd17f2ba1a637232fe22f790c5a769728 (patch)
tree0a31556e0cf705911bb9d2c9e4fcba36276b0720 /text.lua
parent29dac6a6eccf5e5f09debe789fb4f314e460088b (diff)
downloadlines.love-82cdd9ddd17f2ba1a637232fe22f790c5a769728.tar.gz
bugfix: couple of margin-relative computations
Diffstat (limited to 'text.lua')
-rw-r--r--text.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/text.lua b/text.lua
index bafc097..e28a9dc 100644
--- a/text.lua
+++ b/text.lua
@@ -728,7 +728,7 @@ function Text.to_pos_on_line(State, line_index, mx, my)
       -- On all wrapped screen lines but the final one, clicks past end of
       -- line position cursor on final character of screen line.
       -- (The final screen line positions past end of screen line as always.)
-      if screen_line_index < #line_cache.screen_line_starting_pos and mx > Text.screen_line_width(State, line_index, screen_line_index) then
+      if screen_line_index < #line_cache.screen_line_starting_pos and mx > State.left + Text.screen_line_width(State, line_index, screen_line_index) then
 --?         print('past end of non-final line; return')
         return line_cache.screen_line_starting_pos[screen_line_index+1]-1
       end
@@ -978,7 +978,7 @@ function Text.tweak_screen_top_and_cursor(State)
 --?       print('tweak')
       State.cursor1 = {
           line=State.screen_bottom1.line,
-          pos=Text.to_pos_on_line(State, State.screen_bottom1.line, App.screen.width-5, App.screen.height-5),
+          pos=Text.to_pos_on_line(State, State.screen_bottom1.line, State.right-5, App.screen.height-5),
       }
     end
   end