select text with shift + mouseclick

[?]
Jun 4, 2022, 9:14 PM
ZLJGZYQGQ2S4UFWTVF4PQDSGMP6A4IS4GDHCMBAAA5SK2N2NWR3QC

Dependencies

  • [2] LXTTOB33 extract a couple of files
  • [3] ETM7ENJR some helpers
  • [4] BOFNXP5G clicking now moves the cursor even on long, wrapped lines
  • [5] DHI6IJCN selecting text and deleting selections
  • [6] HYEAFRZ2 split mouse_pressed events between Text and Drawing
  • [7] BYG5CEMV support for naming points
  • [8] G6OYAYHU paste in text with M-v
  • [9] 3HDWCPDI bugfix: include shift keys in modifier_down
  • [10] 5FW7YOFT highlight selection while dragging
  • [11] 6LJZN727 handle chords
  • [12] 4QQBMWLL regression: typing uppercase letters in text
  • [13] 2INHXC3K position cursor by clicking on text
  • [14] 2ENZW7TV select text using mouse drag
  • [*] OTIBCAUJ love2d scaffold
  • [*] 3QNOKBFM beginnings of a test harness
  • [*] JF5L2BBS test harness now supports copy/paste
  • [*] AD34IX2Z couple more tests
  • [*] AVTNUQYR basic test-enabled framework

Change contents

  • edit in text_tests.lua at line 162
    [2.5932]
    [2.5932]
    Selection1 = {}
  • edit in text_tests.lua at line 168
    [2.6250]
    [2.6250]
    check_nil(Selection1.line, 'F - test_move_cursor_using_mouse/selection:line')
    check_nil(Selection1.pos, 'F - test_move_cursor_using_mouse/selection:pos')
    end
    function 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.width
    Cursor1 = {line=1, pos=1}
    Screen_top1 = {line=1, pos=1}
    Screen_bottom1 = {}
    Selection1 = {}
    App.draw() -- populate line.y for each line in Lines
    local screen_left_margin = 25 -- pixels
    -- click on first location
    App.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 else
    App.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
    [3.492]
    [3.1486]
    if App.shift_down() then
    Selection1 = {line=Cursor1.line, pos=Cursor1.pos}
    end
  • replacement in main.lua at line 204
    [3.1574][3.234:292](),[3.1837][3.234:292]()
    Selection1 = {line=Cursor1.line, pos=Cursor1.pos}
    [3.1574]
    [3.361]
    if not App.shift_down() then
    Selection1 = {line=Cursor1.line, pos=Cursor1.pos}
    end
  • replacement in main.lua at line 226
    [3.1667][3.541:589](),[3.541][3.541:589]()
    if Text.eq1(Cursor1, Selection1) then
    [3.1667]
    [3.589]
    if Text.eq1(Cursor1, Selection1) and not App.shift_down() then
  • edit in main.lua at line 232
    [3.661]
    [3.661]
    --? print('select:', Selection1.line, Selection1.pos)
  • replacement in keychord.lua at line 31
    [3.258][3.258:287]()
    function App.modifier_down()
    [3.258]
    [3.186]
    function App.any_modifier_down()
  • replacement in keychord.lua at line 36
    [3.35][3.35:107]()
    return love.keyboard.isDown('lctrl') or love.keyboard.isDown('rctrl')
    [3.35]
    [3.107]
    return App.modifier_down('lctrl') or App.modifier_down('rctrl')
  • replacement in keychord.lua at line 40
    [3.136][3.136:206]()
    return love.keyboard.isDown('lalt') or love.keyboard.isDown('ralt')
    [3.136]
    [3.206]
    return App.modifier_down('lalt') or App.modifier_down('ralt')
  • replacement in keychord.lua at line 44
    [3.237][3.237:311]()
    return love.keyboard.isDown('lshift') or love.keyboard.isDown('rshift')
    [3.237]
    [3.311]
    return App.modifier_down('lshift') or App.modifier_down('rshift')
  • replacement in keychord.lua at line 48
    [3.292][3.340:410](),[3.340][3.340:410]()
    return love.keyboard.isDown('lgui') or love.keyboard.isDown('rgui')
    [3.292]
    [3.180]
    return App.modifier_down('lgui') or App.modifier_down('rgui')
  • edit in app.lua at line 187
    [18.2948]
    [18.2948]
    end
    App.modifier_keys = {}
    function App.keypress(key)
    App.modifier_keys[key] = true
    end
    function App.keyrelease(key)
    App.modifier_keys[key] = nil
    end
    function App.modifier_down(key)
    return App.modifier_keys[key]
  • edit in app.lua at line 282
    [19.2712]
    [20.7943]
    App.keypress = nil
    App.keyrelease = nil
    App.modifier_keys = nil
  • edit in app.lua at line 293
    [18.3061]
    [20.8162]
    App.modifier_down = love.keyboard.isDown