bugfix: 'escape' to cancel a stroke
[?]
Jul 5, 2022, 6:04 PM
FFBIY74NM7CMGTVYDMEFOTE2PY5E5TMACASQRK5OXRBGN4B4GTCACDependencies
- [2]
DRFE3B3Zmouse buttons are integers, not strings - [3]
CRYGI3LRmore drawing tests - [4]
7SFHSB47rename - [5]
PX7DDEMOautosave slightly less aggressively - [6]
VCMS2CWTbugfix: escape key to hide online help - [7]
IDG26SXKbugfix in commit e51ce12969 - [8]
XNFTJHC4split keyboard handling between Text and Drawing - [9]
JCSLDGAHbeginnings of support for multiple shapes - [10]
6DE7RBZ6move mouse_released events to Drawing - [11]
DLQMM265scroll past first page - [12]
SRVDX4I5local var - [13]
TVM2WIHHbugfix: autosave and undo in a couple of cases - [14]
JFFUF5ALoverride mouse state lookups in tests - [15]
252M2QMDforgot to move this special case out - [16]
4RUI5X52a few tests for pageup, and a bugfix - [17]
G3C4FKPRbugfix: missed fixing a callsite - [*]
OTIBCAUJlove2d scaffold - [*]
K2X6G75Zstart writing some tests for drawings - [*]
BLWAYPKVextract a module - [*]
WTDKUACNrectangle 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) thenlocal _,drawing = Drawing.current_drawing()if drawing thendrawing.pending = {}end - edit in drawing_tests.lua at line 119
endfunction 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 pixelsLines = 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 lineApp.run_after_mouse_press(Margin_left+5, Margin_top+Drawing_padding_top+6, 1)-- cancelApp.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
if drawing.pending.mode == 'freehand' thenif drawing.pending.mode == nil then-- nothing pendingelseif drawing.pending.mode == 'freehand' then - edit in drawing.lua at line 545[4.11786][22.8168]
elseif chord == 'escape' and App.mouse_down(1) thenlocal _,drawing = Drawing.current_drawing()drawing.pending = {}