select text with shift + mouseclick
[?]
Jun 4, 2022, 9:14 PM
ZLJGZYQGQ2S4UFWTVF4PQDSGMP6A4IS4GDHCMBAAA5SK2N2NWR3QCDependencies
- [2]
LXTTOB33extract a couple of files - [3]
ETM7ENJRsome helpers - [4]
BOFNXP5Gclicking now moves the cursor even on long, wrapped lines - [5]
DHI6IJCNselecting text and deleting selections - [6]
HYEAFRZ2split mouse_pressed events between Text and Drawing - [7]
BYG5CEMVsupport for naming points - [8]
G6OYAYHUpaste in text with M-v - [9]
3HDWCPDIbugfix: include shift keys in modifier_down - [10]
5FW7YOFThighlight selection while dragging - [11]
6LJZN727handle chords - [12]
4QQBMWLLregression: typing uppercase letters in text - [13]
2INHXC3Kposition cursor by clicking on text - [14]
2ENZW7TVselect text using mouse drag - [*]
OTIBCAUJlove2d scaffold - [*]
3QNOKBFMbeginnings of a test harness - [*]
JF5L2BBStest harness now supports copy/paste - [*]
AD34IX2Zcouple more tests - [*]
AVTNUQYRbasic test-enabled framework
Change contents
- edit in text_tests.lua at line 162
Selection1 = {} - edit in text_tests.lua at line 168
check_nil(Selection1.line, 'F - test_move_cursor_using_mouse/selection:line')check_nil(Selection1.pos, 'F - test_move_cursor_using_mouse/selection:pos')endfunction test_select_text_using_mouse()io.write('\ntest_select_text_using_mouse')App.screen.init{width=50, height=60}Lines = load_array{'abc', 'def', 'xyz'}Line_width = App.screen.widthCursor1 = {line=1, pos=1}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}Selection1 = {}App.draw() -- populate line.y for each line in Lineslocal screen_left_margin = 25 -- pixels-- click on first locationApp.run_after_mousepress(screen_left_margin+8,Margin_top+5, '1')App.run_after_mouserelease(screen_left_margin+8,Margin_top+5, '1')-- hold down shift and click somewhere elseApp.keypress('lshift')App.run_after_mousepress(screen_left_margin+20,Margin_top+5, '1')App.run_after_mouserelease(screen_left_margin+20,Margin_top+Line_height+5, '1')App.keyrelease('lshift')check_eq(Cursor1.line, 2, 'F - test_select_text_using_mouse/cursor:line')check_eq(Cursor1.pos, 4, 'F - test_select_text_using_mouse/cursor:pos')check_eq(Selection1.line, 1, 'F - test_select_text_using_mouse/selection:line')check_eq(Selection1.pos, 2, 'F - test_select_text_using_mouse/selection:pos') - edit in main.lua at line 199
if App.shift_down() thenSelection1 = {line=Cursor1.line, pos=Cursor1.pos}end - replacement in main.lua at line 204
Selection1 = {line=Cursor1.line, pos=Cursor1.pos}if not App.shift_down() thenSelection1 = {line=Cursor1.line, pos=Cursor1.pos}end - replacement in main.lua at line 226
if Text.eq1(Cursor1, Selection1) thenif Text.eq1(Cursor1, Selection1) and not App.shift_down() then - edit in main.lua at line 232
--? print('select:', Selection1.line, Selection1.pos) - replacement in keychord.lua at line 31
function App.modifier_down()function App.any_modifier_down() - replacement in keychord.lua at line 36
return love.keyboard.isDown('lctrl') or love.keyboard.isDown('rctrl')return App.modifier_down('lctrl') or App.modifier_down('rctrl') - replacement in keychord.lua at line 40
return love.keyboard.isDown('lalt') or love.keyboard.isDown('ralt')return App.modifier_down('lalt') or App.modifier_down('ralt') - replacement in keychord.lua at line 44
return love.keyboard.isDown('lshift') or love.keyboard.isDown('rshift')return App.modifier_down('lshift') or App.modifier_down('rshift') - replacement in keychord.lua at line 48
return love.keyboard.isDown('lgui') or love.keyboard.isDown('rgui')return App.modifier_down('lgui') or App.modifier_down('rgui') - edit in app.lua at line 187
endApp.modifier_keys = {}function App.keypress(key)App.modifier_keys[key] = trueendfunction App.keyrelease(key)App.modifier_keys[key] = nilendfunction App.modifier_down(key)return App.modifier_keys[key] - edit in app.lua at line 282[19.2712][20.7943]
App.keypress = nilApp.keyrelease = nilApp.modifier_keys = nil - edit in app.lua at line 293[18.3061][20.8162]
App.modifier_down = love.keyboard.isDown