diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2023-06-04 12:20:24 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2023-06-04 12:20:24 -0700 |
commit | 9656e137742eb442e9ce013dd3f25cf6df8c9fad (patch) | |
tree | d4ab8fedbd004dc855192d52bf5908f848196dbc /select.lua | |
parent | cf0ba7c15431221e90f6aee87ea5b69ef0b18ea4 (diff) | |
download | lines.love-9656e137742eb442e9ce013dd3f25cf6df8c9fad.tar.gz |
bugfix: inscript's bug
To fix this I have to first stop incrementally updating screen_bottom1 in the middle of a frame. Now it always has a good value from the end of a frame. I'm also running into some limitations in the test I'd ideally like to write (that are documented in a comment), but I still get some sort of automated test for this bugfix.
Diffstat (limited to 'select.lua')
-rw-r--r-- | select.lua | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/select.lua b/select.lua index c2fe7ad..9b2a278 100644 --- a/select.lua +++ b/select.lua @@ -67,13 +67,8 @@ function Text.draw_highlight(State, line, x,y, pos, lo,hi) end end --- inefficient for some reason, so don't do it on every frame function Text.mouse_pos(State) - local line,pos = Text.to_pos(State, App.mouse_x(), App.mouse_y()) - return line, pos -end - -function Text.to_pos(State, x,y) + local x,y = App.mouse_x(), App.mouse_y() if y < State.line_cache[State.screen_top1.line].starty then return State.screen_top1.line, State.screen_top1.pos end @@ -84,6 +79,7 @@ function Text.to_pos(State, x,y) end end end + return State.screen_bottom1.line, Text.pos_at_end_of_screen_line(State, State.screen_bottom1) end function Text.cut_selection(State) |