From cdef37c4191e48228d1ea83eb590e1f3109e3c8b Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Thu, 1 Jun 2023 22:12:12 -0700 Subject: 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) --- edit.lua | 4 ---- 1 file changed, 4 deletions(-) (limited to 'edit.lua') 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 -- cgit 1.4.1-2-gfad0