about summary refs log tree commit diff stats
path: root/text.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-06-29 09:11:23 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-06-29 09:17:38 -0700
commit8d3adfa36df54305589dd9d43084d1207edc04f1 (patch)
tree6e726dce84842acecdb6707084448900c5919d6d /text.lua
parentb49ff8dde9b45e38fe11324281b8cfd0a8d013ec (diff)
downloadtext.love-8d3adfa36df54305589dd9d43084d1207edc04f1.tar.gz
bugfix: clicking past end of screen line
I could swear I checked this at some point. But I didn't have a test!
Diffstat (limited to 'text.lua')
-rw-r--r--text.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/text.lua b/text.lua
index 6fd47cd..eb6c155 100644
--- a/text.lua
+++ b/text.lua
@@ -685,7 +685,7 @@ function Text.to_pos_on_line(line, mx, my)
       -- (The final screen line positions past end of screen line as always.)
       if mx > Line_width and screen_line_index < #line.screen_line_starting_pos then
 --?         print('past end of non-final line; return')
-        return line.screen_line_starting_pos[screen_line_index+1]
+        return line.screen_line_starting_pos[screen_line_index+1]-1
       end
       local s = string.sub(line.data, screen_line_starting_byte_offset)
 --?       print('return', mx, Text.nearest_cursor_pos(s, mx), '=>', screen_line_starting_pos + Text.nearest_cursor_pos(s, mx) - 1)