about summary refs log tree commit diff stats
path: root/edit.lua
diff options
context:
space:
mode:
Diffstat (limited to 'edit.lua')
-rw-r--r--edit.lua10
1 files changed, 8 insertions, 2 deletions
diff --git a/edit.lua b/edit.lua
index 0958817..1929c52 100644
--- a/edit.lua
+++ b/edit.lua
@@ -352,7 +352,10 @@ function edit.keychord_pressed(State, chord, key)
       State.cursor1 = deepcopy(src.cursor)
       State.selection1 = deepcopy(src.selection)
       patch(State.lines, event.after, event.before)
-      Text.redraw_all(State)  -- if we're scrolling, reclaim all fragments to avoid memory leaks
+      -- invalidate various cached bits of lines
+      State.lines.current_drawing = nil
+      -- if we're scrolling, reclaim all fragments to avoid memory leaks
+      Text.redraw_all(State)
       schedule_save(State)
     end
   elseif chord == 'C-y' then
@@ -364,7 +367,10 @@ function edit.keychord_pressed(State, chord, key)
       State.cursor1 = deepcopy(src.cursor)
       State.selection1 = deepcopy(src.selection)
       patch(State.lines, event.before, event.after)
-      Text.redraw_all(State)  -- if we're scrolling, reclaim all fragments to avoid memory leaks
+      -- invalidate various cached bits of lines
+      State.lines.current_drawing = nil
+      -- if we're scrolling, reclaim all fragments to avoid memory leaks
+      Text.redraw_all(State)
       schedule_save(State)
     end
   -- clipboard