bugfix in changing shape mid-stroke

This commit is contained in:
Kartik K. Agaram 2022-12-12 23:17:02 -08:00
parent 35f81e5139
commit 92eccaea5a
2 changed files with 6 additions and 3 deletions

View File

@ -185,7 +185,7 @@ function test_draw_circle_mid_stroke()
-- draw a circle
App.mouse_move(Editor_state.left+4, Editor_state.top+Drawing_padding_top+4) -- hover on drawing
edit.run_after_mouse_press(Editor_state, Editor_state.left+35, Editor_state.top+Drawing_padding_top+36, 1)
edit.run_after_keychord(Editor_state, 'o')
edit.run_after_textinput(Editor_state, 'o')
edit.run_after_mouse_release(Editor_state, Editor_state.left+35+30, Editor_state.top+Drawing_padding_top+36, 1)
local drawing = Editor_state.lines[1]
check_eq(#drawing.shapes, 1, 'F - test_draw_circle_mid_stroke/#shapes')

View File

@ -289,8 +289,11 @@ function edit.textinput(State, t)
p.name = p.name..t
record_undo_event(State, {before=before, after=snapshot(State, State.lines.current_drawing_index)})
else
for _,line_cache in ipairs(State.line_cache) do line_cache.starty = nil end -- just in case we scroll
Text.textinput(State, t)
local drawing_index, drawing = Drawing.current_drawing(State)
if drawing_index == nil then
for _,line_cache in ipairs(State.line_cache) do line_cache.starty = nil end -- just in case we scroll
Text.textinput(State, t)
end
end
schedule_save(State)
end