change how we handle clicks above top margin
[?]
Jun 3, 2023, 5:36 PM
6RYLD5ONDIQFWU5CNL4NGHJQ2LNAZZFGTPXQJDNJGLNYAUOTUI7QCDependencies
- [2]
GNKUD23Iget rid of recent_mouse - [3]
3TCZ7ADHmove - [4]
ORRSP7FVdeduce test names on failures - [5]
7RKFA3VAfailing test now looks realistic - [6]
LF7BWEG4group all editor globals - [7]
RMKMPFT5fix a corner case when selecting text - [8]
356GY7IQunify two similar functions - [9]
VSBSWTE4bugfix: where cursor is drawn - [10]
ZLJGZYQGselect text with shift + mouseclick - [11]
WAR3HXHTtest both ways of selecting text with mouse - [12]
LXTTOB33extract a couple of files - [13]
T3B4NLV3include a unit test - [*]
KOTI3MFGbugfix in previous commit - [*]
MXA3RZYKdeduce left/right from state where possible - [*]
S2MISTTMadd state arg to a few functions - [*]
2L5MEZV3experiment: new edit namespace - [*]
LNUHQOGHstart passing in Editor_state explicitly - [*]
3QNOKBFMbeginnings of a test harness - [*]
4EGQRXDAbugfix: naming points
Change contents
- edit in text_tests.lua at line 2
-- Arguably this should be called edit_tests.lua,-- but that would mess up the git blame at this point. - edit in text_tests.lua at line 831
endfunction test_select_text_using_mouse_starting_above_text()App.screen.init{width=50, height=60}Editor_state = edit.initialize_test_state()Editor_state.lines = load_array{'abc', 'def', 'xyz'}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 = {}edit.draw(Editor_state) -- populate line_cache.starty for each line Editor_state.line_cache-- press mouse above first line of textedit.run_after_mouse_press(Editor_state, Editor_state.left+8,5, 1)check(Editor_state.selection1.line ~= nil, 'selection:line-not-nil')check_eq(Editor_state.selection1.line, 1, 'selection:line')check_eq(Editor_state.selection1.pos, 1, 'selection:pos') - edit in text_tests.lua at line 926
--? function test_select_all_text_then_mouse_press_outside_text()--? -- display a single line of text--? App.screen.init{width=75, height=80}--? Editor_state = edit.initialize_test_state()--? Editor_state.lines = load_array{'abc def'}--? Text.redraw_all(Editor_state)--? Editor_state.cursor1 = {line=1, pos=1}--? Editor_state.screen_top1 = {line=1, pos=1}--? Editor_state.screen_bottom1 = {}--? edit.draw(Editor_state)--? -- select all--? App.fake_key_press('lctrl')--? edit.run_after_keychord(Editor_state, 'C-a')--? App.fake_key_release('lctrl')--? edit.key_release(Editor_state, 'lctrl')--? -- selection--? check_eq(Editor_state.selection1.line, 1, 'selection:line')--? check_eq(Editor_state.selection1.pos, 1, 'selection:pos')--? check_eq(Editor_state.cursor1.line, 1, 'cursor:line')--? check_eq(Editor_state.cursor1.pos, 8, 'cursor:pos')--? -- part of a mouse click outside the selected line--? edit.run_after_mouse_press(Editor_state, 45, Margin_top + Editor_state.line_height + 10, --[[mouse button]] 1)--? end - edit in select.lua at line 77
if y < State.line_cache[State.screen_top1.line].starty thenreturn State.screen_top1.line, State.screen_top1.posend - edit in edit.lua at line 230
if y < State.top thenState.old_cursor1 = State.cursor1State.old_selection1 = State.selection1State.mousepress_shift = App.shift_down()State.selection1 = {line=1,pos=1,}returnend - edit in app.lua at line 364[21.1994][3.60666]
--? _G[name]()