bugfix: naming points
[?]
Mar 26, 2023, 4:36 PM
4EGQRXDANFLUYXADP3MNHZWP2LBH2P5VBVKNN5RT6ERGMBVSRI2ACDependencies
- [2]
K6DTOGOQflip return value of button handlers - [3]
ORRSP7FVdeduce test names on failures - [4]
5Y24ZDZIbugfix - [5]
LNUHQOGHstart passing in Editor_state explicitly - [6]
MTJEVRJRadd state arg to a few functions - [7]
2CK5QI7Wmake love event names consistent - [8]
3QQZ7W4Ebring couple more globals back to the app level - [9]
6D5MOJS4allow buttons to interrupt events - [10]
AVTNUQYRbasic test-enabled framework - [11]
PP2IIHL6stop putting button state in a global - [12]
LF7BWEG4group all editor globals - [13]
KYNGDE2Cconsistent names in a few more places - [14]
5ZA3BRNYadd state arg to a few functions - [15]
2L5MEZV3experiment: new edit namespace - [*]
BULPIBEGbeginnings of a module for the text editor - [*]
Z5HLXU4Padd state arg to a few functions - [*]
K2X6G75Zstart writing some tests for drawings - [*]
L6XA5EY2test: moving a point - [*]
3QNOKBFMbeginnings of a test harness - [*]
FCFJVYKYredundant check
Change contents
- edit in text.lua at line 164
assert(State.lines[State.cursor1.line].mode == 'text') - replacement in edit.lua at line 229
--? print('press', State.selection1.line, State.selection1.pos)--? print('press', State.cursor1.line) - replacement in edit.lua at line 272
--? print('release')--? print('release', State.cursor1.line) - edit in edit.lua at line 324
--? print('text input', t) - replacement in edit.lua at line 329
elseif State.current_drawing_mode == 'name' thenelseif State.lines.current_drawing and State.current_drawing_mode == 'name' then - replacement in edit.lua at line 482
elseif State.current_drawing_mode == 'name' thenelseif State.lines.current_drawing and State.current_drawing_mode == 'name' then - edit in drawing_tests.lua at line 460
function test_name_point_then_exit_drawing()-- create a drawing with a lineApp.screen.init{width=Test_margin_left+256, height=300} -- drawing coordinates 1:1 with pixelsEditor_state = edit.initialize_test_state()Editor_state.filename = 'foo'Editor_state.lines = load_array{'```lines', '```', ''}Text.redraw_all(Editor_state)edit.check_locs(Editor_state)Editor_state.current_drawing_mode = 'line'edit.draw(Editor_state)-- draw a lineedit.run_after_mouse_press(Editor_state, Editor_state.left+5, Editor_state.top+Drawing_padding_top+6, 1)edit.run_after_mouse_release(Editor_state, Editor_state.left+35, Editor_state.top+Drawing_padding_top+36, 1)local drawing = Editor_state.lines[1]check_eq(#drawing.shapes, 1, 'baseline/#shapes')check_eq(#drawing.points, 2, 'baseline/#points')check_eq(drawing.shapes[1].mode, 'line', 'baseline/shape:1')local p1 = drawing.points[drawing.shapes[1].p1]local p2 = drawing.points[drawing.shapes[1].p2]check_eq(p1.x, 5, 'baseline/p1:x')check_eq(p1.y, 6, 'baseline/p1:y')check_eq(p2.x, 35, 'baseline/p2:x')check_eq(p2.y, 36, 'baseline/p2:y')check_nil(p2.name, 'baseline/p2:name')-- enter 'name' mode without moving the mouseedit.run_after_keychord(Editor_state, 'C-n')check_eq(Editor_state.current_drawing_mode, 'name', 'mode:1')-- click outside the drawingedit.run_after_mouse_click(Editor_state, App.screen.width-5, App.screen.height-5, 1)-- press a keyedit.run_after_text_input(Editor_state, 'a')-- key goes to textcheck_eq(Editor_state.lines[2].data, 'a')end - edit in app.lua at line 372[22.47][3.60666]
--? print('=== '..name) - replacement in app.lua at line 384
local stack_trace = debug.traceback('', --[[stack frame]]5)local stack_trace = debug.traceback('', --[[stack frame]]4) - edit in app.lua at line 387
--? local full_error = file_and_line_number..':'..test_name..' -- '..err_without_line_number..'\t\t'..stack_trace:gsub('\n', '\n\t\t')