about summary refs log tree commit diff stats
path: root/source_undo.lua
diff options
context:
space:
mode:
Diffstat (limited to 'source_undo.lua')
-rw-r--r--source_undo.lua10
1 files changed, 1 insertions, 9 deletions
diff --git a/source_undo.lua b/source_undo.lua
index e5dea93..8f21a9c 100644
--- a/source_undo.lua
+++ b/source_undo.lua
@@ -57,16 +57,8 @@ function snapshot(State, s,e)
     end_line=e,
     -- no filename; undo history is cleared when filename changes
   }
-  -- deep copy lines without cached stuff like text fragments
   for i=s,e do
-    local line = State.lines[i]
-    if line.mode == 'text' then
-      table.insert(event.lines, {mode='text', data=line.data})  -- I've forgotten: should we deepcopy(line.data)?
-    elseif line.mode == 'drawing' then
-      table.insert(event.lines, {mode='drawing', h=line.h, points=deepcopy(line.points), shapes=deepcopy(line.shapes), pending={}})
-    else
-      assert(false, ('unknown line mode %s'):format(line.mode))
-    end
+    table.insert(event.lines, deepcopy(State.lines[i]))
   end
   return event
 end