bugfix: don't delete selection when moving cursor

[?]
Jun 23, 2022, 7:05 PM
7EQLPB3O4DPUWGILY4P5D32SSIKL63QWWU5XRL2HISGNJXFWD2SAC

Dependencies

  • [2] KMRJOSLY bugfix: delete selection before pasting
  • [3] YTSPVDZH first successful pagedown test, first bug found by test
  • [4] ESETRNLB bugfix: printing the first part of a line at the bottom made it seem non-wrapping
  • [5] Z4XRNDTR find text
  • [6] 65XHTZEK regression: couldn't do many drawing operations because line.y was reset
  • [7] JCSLDGAH beginnings of support for multiple shapes
  • [8] 5FW7YOFT highlight selection while dragging
  • [9] OYXDYPGS get rid of debug variables
  • [10] G3C4FKPR bugfix: missed fixing a callsite
  • [11] AVTNUQYR basic test-enabled framework
  • [*] LXTTOB33 extract a couple of files
  • [*] EMHRPJ3R no, that's not right
  • [*] FYS7TCDW bugfix
  • [*] OTIBCAUJ love2d scaffold
  • [*] 6LJZN727 handle chords
  • [*] ZLJGZYQG select text with shift + mouseclick
  • [*] 3HDWCPDI bugfix: include shift keys in modifier_down

Change contents

  • edit in text_tests.lua at line 209
    [14.746]
    [15.2]
    end
    function test_cursor_movement_without_shift_resets_selection()
    io.write('\ntest_cursor_movement_without_shift_resets_selection')
    -- display a line of text with some part selected
    App.screen.init{width=80, height=80}
    Lines = load_array{'abc'}
    Line_width = 75
    Cursor1 = {line=1, pos=1}
    Selection1 = {line=1, pos=2}
    Screen_top1 = {line=1, pos=1}
    Screen_bottom1 = {}
    App.draw()
    -- press an arrow key without shift
    App.run_after_keychord('right')
    -- no change to data, selection is reset
    check_nil(Selection1.line, 'F - test_cursor_movement_without_shift_resets_selection')
    check_eq(Lines[1].data, 'abc', 'F - test_cursor_movement_without_shift_resets_selection/data')
  • replacement in main.lua at line 417
    [3.1550][2.1148:1288]()
    if Selection1.line and not App.shift_down() and chord ~= 'C-c' and chord ~= 'C-x' and chord ~= 'backspace' and backspace ~= 'delete' then
    [3.1550]
    [2.1288]
    if Selection1.line and not App.shift_down() and chord ~= 'C-c' and chord ~= 'C-x' and chord ~= 'backspace' and backspace ~= 'delete' and not App.is_cursor_movement(chord) then
  • edit in keychord.lua at line 50
    [18.1962]
    [19.180]
    end
    function App.is_cursor_movement(key)
    return array.find({'left', 'right', 'up', 'down', 'home', 'end', 'pageup', 'pagedown'}, key)