about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--drawing_tests.lua2
-rw-r--r--edit.lua7
2 files changed, 6 insertions, 3 deletions
diff --git a/drawing_tests.lua b/drawing_tests.lua
index 80a91f1..8bcaa43 100644
--- a/drawing_tests.lua
+++ b/drawing_tests.lua
@@ -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')
diff --git a/edit.lua b/edit.lua
index a7d3027..0a30c77 100644
--- a/edit.lua
+++ b/edit.lua
@@ -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