From 86517606a1fafcbff97b5646b74cd186a575cf68 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sat, 1 Apr 2023 20:39:39 -0700 Subject: [PATCH] clean up some final bifold code --- source_file.lua | 20 ++------------------ source_undo.lua | 2 +- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/source_file.lua b/source_file.lua index 194ef9b..3adab1f 100644 --- a/source_file.lua +++ b/source_file.lua @@ -1,7 +1,5 @@ -- primitives for saving to file and loading from file -Fold = '\x1e' -- ASCII RS (record separator) - function file_exists(filename) local infile = App.open_for_reading(filename) if infile then @@ -28,13 +26,7 @@ function load_from_file(infile) if line == '```lines' then -- inflexible with whitespace since these files are always autogenerated table.insert(result, load_drawing(infile_next_line)) else - local line_info = {mode='text'} - if line:find(Fold) then - _, _, line_info.data, line_info.dataB = line:find('([^'..Fold..']*)'..Fold..'([^'..Fold..']*)') - else - line_info.data = line - end - table.insert(result, line_info) + table.insert(result, {mode='text', data=line}) end end end @@ -54,10 +46,6 @@ function save_to_disk(State) store_drawing(outfile, line) else outfile:write(line.data) - if line.dataB and #line.dataB > 0 then - outfile:write(Fold) - outfile:write(line.dataB) - end outfile:write('\n') end end @@ -147,11 +135,7 @@ function load_array(a) else --? print('inserting text') local line_info = {mode='text'} - if line:find(Fold) then - _, _, line_info.data, line_info.dataB = line:find('([^'..Fold..']*)'..Fold..'([^'..Fold..']*)') - else - line_info.data = line - end + line_info.data = line table.insert(result, line_info) end end diff --git a/source_undo.lua b/source_undo.lua index 6023324..d699211 100644 --- a/source_undo.lua +++ b/source_undo.lua @@ -61,7 +61,7 @@ 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, dataB=line.dataB}) + table.insert(event.lines, {mode='text', data=line.data}) elseif line.mode == 'drawing' then local points=deepcopy(line.points) --? print('copying', line.points, 'with', #line.points, 'points into', points)