diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2024-07-08 00:22:56 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2024-07-08 00:24:14 -0700 |
commit | 0fcbe310a21dc581a29d22366e20629fc9e321ac (patch) | |
tree | 27205c6ec50480ae4c7748a8dd5f57b69efa848e /source_undo.lua | |
parent | 91a08eec2b39a38db9a6952a5701617da549d970 (diff) | |
download | text.love-0fcbe310a21dc581a29d22366e20629fc9e321ac.tar.gz |
simplify some code now that lines contains no derived data
Diffstat (limited to 'source_undo.lua')
-rw-r--r-- | source_undo.lua | 10 |
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 |