bugfix: clear selection when clicking above or below lines
[?]
Sep 20, 2023, 8:39 PM
656FM555BRGLHJ7PTIZXD2IY5T7PGFEYSHG2T3Z7WNX6QZ5KROSACDependencies
- [2]
SGMA5JLEsave the list of tests in repo - [3]
6XCJX4DZbugfix: inscript's bug - [4]
5SM6DRHKport inscript's bugfix to source editor - [5]
7FPELAZBah, I see the problem - [6]
2L5MEZV3experiment: new edit namespace - [7]
G54H3YG2get rid of all bifold text - [8]
MRA2Y3EEidea: set recent_mouse on mouse events - [9]
KMSL74GAsupport selections in the source editor - [10]
LNUHQOGHstart passing in Editor_state explicitly - [11]
QJISOCHJsome temporary logging to catch a bug - [12]
GNKUD23Iget rid of recent_mouse - [13]
KKMFQDR4editing source code from within the app - [14]
GFXWHTE6mouse wheel support - [15]
LF7BWEG4group all editor globals - [*]
LXTTOB33extract a couple of files - [*]
5BMR5HRTclick to the left of a line - [*]
EKKFWP4Dbugfix: couple of margin-relative computations - [*]
H3ECRBXFbugfix: clicking on empty lines - [*]
ORRSP7FVdeduce test names on failures - [*]
Y2ZIPXEMnew test
Change contents
- edit in text_tests.lua at line 278
Editor_state.selection1 = {} - edit in text_tests.lua at line 298
Editor_state.selection1 = {} - edit in text_tests.lua at line 317
Editor_state.selection1 = {} - edit in text_tests.lua at line 322
check_eq(Editor_state.cursor1.line, 1, 'cursor')-- selection remains emptycheck_nil(Editor_state.selection1.line, 'selection is empty to avoid perturbing future edits')endfunction test_click_below_all_lines()-- display one lineApp.screen.init{width=50, height=80}Editor_state = edit.initialize_test_state()Editor_state.lines = load_array{'abc'}Text.redraw_all(Editor_state)Editor_state.cursor1 = {line=1, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}Editor_state.selection1 = {}-- click below first lineedit.draw(Editor_state)edit.run_after_mouse_click(Editor_state, Editor_state.left+8,Editor_state.top+50, 1)-- cursor doesn't move - edit in text_tests.lua at line 342[21.2330][22.524]
-- selection remains emptycheck_nil(Editor_state.selection1.line, 'selection is empty to avoid perturbing future edits') - edit in text_tests at line 26
click below final line does nothing - edit in source_text_tests.lua at line 278
Editor_state.selection1 = {} - edit in source_text_tests.lua at line 298
Editor_state.selection1 = {} - edit in source_text_tests.lua at line 317
Editor_state.selection1 = {} - edit in source_text_tests.lua at line 322
check_eq(Editor_state.cursor1.line, 1, 'cursor')-- selection remains emptycheck_nil(Editor_state.selection1.line, 'selection is empty to avoid perturbing future edits')endfunction test_click_below_all_lines()-- display one lineApp.screen.init{width=50, height=80}Editor_state = edit.initialize_test_state()Editor_state.lines = load_array{'abc'}Text.redraw_all(Editor_state)Editor_state.cursor1 = {line=1, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}Editor_state.selection1 = {}-- click below first lineedit.draw(Editor_state)edit.run_after_mouse_click(Editor_state, Editor_state.left+8,Editor_state.top+50, 1)-- cursor doesn't move - edit in source_text_tests.lua at line 342
-- selection remains emptycheck_nil(Editor_state.selection1.line, 'selection is empty to avoid perturbing future edits') - replacement in source_edit.lua at line 298
-- still here? click is below all screen lines-- still here? mouse press is below all screen lines - edit in source_edit.lua at line 320
if y < State.top thenState.cursor1 = {line=State.screen_top1.line, pos=State.screen_top1.pos}edit.clean_up_mouse_press(State)returnend - replacement in source_edit.lua at line 335
if State.mousepress_shift thenif State.old_selection1.line == nil thenState.selection1 = State.old_cursor1elseState.selection1 = State.old_selection1endendState.old_cursor1, State.old_selection1, State.mousepress_shift = nilif eq(State.cursor1, State.selection1) thenState.selection1 = {}endbreakedit.clean_up_mouse_press(State)return - edit in source_edit.lua at line 340
-- still here? mouse release is below all screen linesState.cursor1.line, State.cursor1.pos = State.screen_bottom1.line, Text.pos_at_end_of_screen_line(State, State.screen_bottom1)edit.clean_up_mouse_press(State) - edit in source_edit.lua at line 345
endendfunction edit.clean_up_mouse_press(State)if State.mousepress_shift thenif State.old_selection1.line == nil thenState.selection1 = State.old_cursor1elseState.selection1 = State.old_selection1end - edit in source_edit.lua at line 356
State.old_cursor1, State.old_selection1, State.mousepress_shift = nilif eq(State.cursor1, State.selection1) thenState.selection1 = {}end - replacement in edit.lua at line 294
-- still here? click is below all screen lines-- still here? mouse press is below all screen lines - edit in edit.lua at line 316
if y < State.top thenState.cursor1 = {line=State.screen_top1.line, pos=State.screen_top1.pos}edit.clean_up_mouse_press(State)returnend - replacement in edit.lua at line 331[5.354]→[5.5833:5978](∅→∅),[5.744]→[5.5833:5978](∅→∅),[5.1049]→[5.5833:5978](∅→∅),[3.2969]→[5.5833:5978](∅→∅),[5.5833]→[5.5833:5978](∅→∅),[5.5978]→[5.9343:9360](∅→∅),[5.101854]→[5.9343:9360](∅→∅),[5.9343]→[5.9343:9360](∅→∅),[5.9360]→[5.5979:6033](∅→∅),[5.6033]→[5.9402:9432](∅→∅),[5.101923]→[5.9402:9432](∅→∅),[5.9402]→[5.9402:9432](∅→∅),[5.9432]→[5.6034:6202](∅→∅),[5.6202]→[5.9564:9594](∅→∅),[5.102134]→[5.9564:9594](∅→∅),[5.9564]→[5.9564:9594](∅→∅)
if State.mousepress_shift thenif State.old_selection1.line == nil thenState.selection1 = State.old_cursor1elseState.selection1 = State.old_selection1endendState.old_cursor1, State.old_selection1, State.mousepress_shift = nilif eq(State.cursor1, State.selection1) thenState.selection1 = {}endbreakedit.clean_up_mouse_press(State)return - edit in edit.lua at line 336
-- still here? mouse release is below all screen linesState.cursor1.line, State.cursor1.pos = State.screen_bottom1.line, Text.pos_at_end_of_screen_line(State, State.screen_bottom1)edit.clean_up_mouse_press(State) - edit in edit.lua at line 341
endendfunction edit.clean_up_mouse_press(State)if State.mousepress_shift thenif State.old_selection1.line == nil thenState.selection1 = State.old_cursor1elseState.selection1 = State.old_selection1end - edit in edit.lua at line 352
State.old_cursor1, State.old_selection1, State.mousepress_shift = nilif eq(State.cursor1, State.selection1) thenState.selection1 = {}end