bugfix: typing a capital letter deletes selection

[?]
Jun 27, 2022, 12:07 AM
CIQN2MDEMWAASJAHOHMUZTI5PF4JV5SZSOBYYDCIIFYO2VHWULKAC

Dependencies

  • [2] 7EQLPB3O bugfix: don't delete selection when moving cursor
  • [3] OTIBCAUJ love2d scaffold
  • [4] VHQCNMAR several more modules
  • [5] G3C4FKPR bugfix: missed fixing a callsite
  • [6] EMHRPJ3R no, that's not right
  • [7] 5FW7YOFT highlight selection while dragging
  • [8] ESETRNLB bugfix: printing the first part of a line at the bottom made it seem non-wrapping
  • [9] FYS7TCDW bugfix
  • [10] KMRJOSLY bugfix: delete selection before pasting
  • [11] 6DE7RBZ6 move mouse_released events to Drawing
  • [12] JCSLDGAH beginnings of support for multiple shapes
  • [13] PX7DDEMO autosave slightly less aggressively
  • [14] BYG5CEMV support for naming points
  • [15] Z4XRNDTR find text
  • [16] 65XHTZEK regression: couldn't do many drawing operations because line.y was reset
  • [17] EF6MFB46 assume we always have a filename
  • [18] AVTNUQYR basic test-enabled framework
  • [19] HRWN5V6J Devine's suggestion to try to live with just freehand
  • [20] ZX3VAHVU stop generating invalid keychords
  • [21] YTSPVDZH first successful pagedown test, first bug found by test
  • [22] 6LJZN727 handle chords
  • [23] IFGAJAF7 add a level of indirection to vertices of shapes
  • [24] OYXDYPGS get rid of debug variables
  • [*] LXTTOB33 extract a couple of files
  • [*] VG75U7IM bugfix: typing should delete highlighted text
  • [*] 4WAFGF4Z selection bugfix

Change contents

  • edit in text_tests.lua at line 262
    [27.520]
    [28.2]
    end
    function test_edit_with_shift_key_deletes_selection()
    io.write('\ntest_edit_with_shift_key_deletes_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()
    -- mimic precise keypresses for a capital letter
    App.fake_key_press('lshift')
    App.keypressed('d')
    App.textinput('D')
    App.keyreleased('d')
    App.fake_key_release('lshift')
    -- selected text is deleted and replaced with the key
    check_nil(Selection1.line, 'F - test_edit_with_shift_key_deletes_selection')
    check_eq(Lines[1].data, 'Dbc', 'F - test_edit_with_shift_key_deletes_selection/data')
  • replacement in main.lua at line 416
    [3.3121][3.1513:1550](),[3.1550][2.708:886]()
    function App.keychord_pressed(chord)
    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
    [3.3121]
    [3.1288]
    function App.keychord_pressed(chord, key)
    if Selection1.line and
    -- printable character created using shift key => delete selection
    -- (we're not creating any ctrl-shift- or alt-shift- combinations using regular/printable keys)
    (not App.shift_down() or utf8.len(key) == 1) and
    chord ~= 'C-c' and chord ~= 'C-x' and chord ~= 'backspace' and backspace ~= 'delete' and not App.is_cursor_movement(chord) then
  • replacement in keychord.lua at line 11
    [3.801][3.1643:1694]()
    App.keychord_pressed(App.combine_modifiers(key))
    [3.801]
    [3.844]
    App.keychord_pressed(App.combine_modifiers(key), key)