diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2023-04-01 17:34:48 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2023-04-01 20:40:47 -0700 |
commit | af239935ce849f0a1f4a4708acd65faf6eb6d84b (patch) | |
tree | 93f2e6e724d397c214811b8cfd6f92d70bb0361a | |
parent | 86517606a1fafcbff97b5646b74cd186a575cf68 (diff) | |
download | lines.love-af239935ce849f0a1f4a4708acd65faf6eb6d84b.tar.gz |
minor cleanup and a todo for later
-rw-r--r-- | source_undo.lua | 9 | ||||
-rw-r--r-- | undo.lua | 9 |
2 files changed, 4 insertions, 14 deletions
diff --git a/source_undo.lua b/source_undo.lua index d699211..d3d5f0f 100644 --- a/source_undo.lua +++ b/source_undo.lua @@ -61,14 +61,9 @@ function snapshot(State, s,e) for i=s,e do local line = State.lines[i] if line.mode == 'text' then - table.insert(event.lines, {mode='text', data=line.data}) + table.insert(event.lines, {mode='text', data=line.data}) -- I've forgotten: should we deepcopy(line.data)? elseif line.mode == 'drawing' then - local points=deepcopy(line.points) ---? print('copying', line.points, 'with', #line.points, 'points into', points) - local shapes=deepcopy(line.shapes) ---? print('copying', line.shapes, 'with', #line.shapes, 'shapes into', shapes) - table.insert(event.lines, {mode='drawing', h=line.h, points=points, shapes=shapes, pending={}}) ---? table.insert(event.lines, {mode='drawing', h=line.h, points=deepcopy(line.points), shapes=deepcopy(line.shapes), pending={}}) + table.insert(event.lines, {mode='drawing', h=line.h, points=deepcopy(line.points), shapes=deepcopy(line.shapes), pending={}}) else print(line.mode) assert(false) diff --git a/undo.lua b/undo.lua index d699211..d3d5f0f 100644 --- a/undo.lua +++ b/undo.lua @@ -61,14 +61,9 @@ function snapshot(State, s,e) for i=s,e do local line = State.lines[i] if line.mode == 'text' then - table.insert(event.lines, {mode='text', data=line.data}) + table.insert(event.lines, {mode='text', data=line.data}) -- I've forgotten: should we deepcopy(line.data)? elseif line.mode == 'drawing' then - local points=deepcopy(line.points) ---? print('copying', line.points, 'with', #line.points, 'points into', points) - local shapes=deepcopy(line.shapes) ---? print('copying', line.shapes, 'with', #line.shapes, 'shapes into', shapes) - table.insert(event.lines, {mode='drawing', h=line.h, points=points, shapes=shapes, pending={}}) ---? table.insert(event.lines, {mode='drawing', h=line.h, points=deepcopy(line.points), shapes=deepcopy(line.shapes), pending={}}) + table.insert(event.lines, {mode='drawing', h=line.h, points=deepcopy(line.points), shapes=deepcopy(line.shapes), pending={}}) else print(line.mode) assert(false) |