diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2023-06-01 22:12:12 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2023-06-01 22:12:12 -0700 |
commit | cdef37c4191e48228d1ea83eb590e1f3109e3c8b (patch) | |
tree | fb7546965cbf9d7d4ce83b2c7aa71509dfcce685 /edit.lua | |
parent | 9b27a4d816bbfc23f122698e65f660d89c7664e4 (diff) | |
download | lines.love-cdef37c4191e48228d1ea83eb590e1f3109e3c8b.tar.gz |
get rid of recent_mouse
It's a hack: - if you start selecting from below final line the start of the selection is the most recent click even if it was forever ago - (the crash we're currently fixing) if you start up and immediately select all then click below final line => crash. recent_mouse was never set. - getting rid of it breaks no tests (except the crash we're currently fixing)
Diffstat (limited to 'edit.lua')
-rw-r--r-- | edit.lua | 4 |
1 files changed, 0 insertions, 4 deletions
diff --git a/edit.lua b/edit.lua index 82d9542..3e92a54 100644 --- a/edit.lua +++ b/edit.lua @@ -75,8 +75,6 @@ function edit.initialize_state(top, left, right, font_height, line_height) -- c old_cursor1 = nil, old_selection1 = nil, mousepress_shift = nil, - -- when selecting text, avoid recomputing some state on every single frame - recent_mouse = {}, -- cursor coordinates in pixels cursor_x = 0, @@ -249,7 +247,6 @@ function edit.mouse_press(State, x,y, mouse_button) line=line_index, pos=Text.to_pos_on_line(State, line_index, x, y), } - State.recent_mouse = {time=Current_time, line=State.selection1.line, pos=State.selection1.pos} break end elseif line.mode == 'drawing' then @@ -286,7 +283,6 @@ function edit.mouse_release(State, x,y, mouse_button) pos=Text.to_pos_on_line(State, line_index, x, y), } print_and_log(('edit.mouse_release: cursor now %d,%d'):format(State.cursor1.line, State.cursor1.pos)) - State.recent_mouse = {time=Current_time, line=State.cursor1.line, pos=State.cursor1.pos} if State.mousepress_shift then if State.old_selection1.line == nil then State.selection1 = State.old_cursor1 |