From 0fcbe310a21dc581a29d22366e20629fc9e321ac Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Mon, 8 Jul 2024 00:22:56 -0700 Subject: simplify some code now that lines contains no derived data --- source_undo.lua | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'source_undo.lua') 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 -- cgit 1.4.1-2-gfad0