bugfix: 'escape' to cancel a stroke

[?]
Jul 5, 2022, 6:04 PM
FFBIY74NM7CMGTVYDMEFOTE2PY5E5TMACASQRK5OXRBGN4B4GTCAC

Dependencies

  • [2] DRFE3B3Z mouse buttons are integers, not strings
  • [3] CRYGI3LR more drawing tests
  • [4] 7SFHSB47 rename
  • [5] PX7DDEMO autosave slightly less aggressively
  • [6] VCMS2CWT bugfix: escape key to hide online help
  • [7] IDG26SXK bugfix in commit e51ce12969
  • [8] XNFTJHC4 split keyboard handling between Text and Drawing
  • [9] JCSLDGAH beginnings of support for multiple shapes
  • [10] 6DE7RBZ6 move mouse_released events to Drawing
  • [11] DLQMM265 scroll past first page
  • [12] SRVDX4I5 local var
  • [13] TVM2WIHH bugfix: autosave and undo in a couple of cases
  • [14] JFFUF5AL override mouse state lookups in tests
  • [15] 252M2QMD forgot to move this special case out
  • [16] 4RUI5X52 a few tests for pageup, and a bugfix
  • [17] G3C4FKPR bugfix: missed fixing a callsite
  • [*] OTIBCAUJ love2d scaffold
  • [*] K2X6G75Z start writing some tests for drawings
  • [*] BLWAYPKV extract a module
  • [*] WTDKUACN rectangle and square shapes

Change contents

  • edit in main.lua at line 536
    [4.233][2.1403:1457](),[2.1457][4.8:56](),[4.1464][4.8:56](),[4.62][4.8:56](),[4.56][4.108:155](),[4.108][4.108:155](),[4.155][4.3:11]()
    elseif chord == 'escape' and App.mouse_down(1) then
    local _,drawing = Drawing.current_drawing()
    if drawing then
    drawing.pending = {}
    end
  • edit in drawing_tests.lua at line 119
    [3.3277]
    [3.3277]
    end
    function test_cancel_stroke()
    io.write('\ntest_cancel_stroke')
    -- display a drawing followed by a line of text (you shouldn't ever have a drawing right at the end)
    Filename = 'foo'
    App.screen.init{width=Margin_width+256, height=300} -- drawing coordinates 1:1 with pixels
    Lines = load_array{'```lines', '```', ''}
    Current_drawing_mode = 'line'
    App.draw()
    check_eq(#Lines, 2, 'F - test_cancel_stroke/baseline/#lines')
    check_eq(Lines[1].mode, 'drawing', 'F - test_cancel_stroke/baseline/mode')
    check_eq(Lines[1].y, Margin_top+Drawing_padding_top, 'F - test_cancel_stroke/baseline/y')
    check_eq(Lines[1].h, 128, 'F - test_cancel_stroke/baseline/y')
    check_eq(#Lines[1].shapes, 0, 'F - test_cancel_stroke/baseline/#shapes')
    -- start drawing a line
    App.run_after_mouse_press(Margin_left+5, Margin_top+Drawing_padding_top+6, 1)
    -- cancel
    App.run_after_keychord('escape')
    App.run_after_mouse_release(Margin_left+35, Margin_top+Drawing_padding_top+36, 1)
    local drawing = Lines[1]
    check_eq(#drawing.shapes, 0, 'F - test_cancel_stroke/#shapes')
  • replacement in drawing.lua at line 290
    [4.74][4.74:123]()
    if drawing.pending.mode == 'freehand' then
    [4.74]
    [4.338]
    if drawing.pending.mode == nil then
    -- nothing pending
    elseif drawing.pending.mode == 'freehand' then
  • edit in drawing.lua at line 545
    [4.11786]
    [22.8168]
    elseif chord == 'escape' and App.mouse_down(1) then
    local _,drawing = Drawing.current_drawing()
    drawing.pending = {}