simplify some code now that lines contains no derived data
Dependencies
- [2]
GGWAHCLEminor cleanup and a todo for later - [3]
G3DLS5OUaudit all asserts - [4]
73OCE2MCafter much struggle, a brute-force undo - [5]
MTJEVRJRadd state arg to a few functions - [6]
IFTYOERMline.y -> line_cache.starty in a few more places - [7]
FUOURDEYclean up some final bifold code - [8]
AYG2PQCGfix a couple of asserts missed in the recent audit - [9]
KKMFQDR4editing source code from within the app - [10]
OI4FPFINsupport drawings in the source editor - [11]
VJ77YABHmore efficient undo/redo - [12]
LF7BWEG4group all editor globals
Change contents
- edit in undo.lua at line 60
-- deep copy lines without cached stuff like text fragments - replacement in undo.lua at line 61[4.269]→[4.985:1017](∅→∅),[4.295]→[4.1592:1624](∅→∅),[4.1017]→[4.1592:1624](∅→∅),[4.1102]→[4.1592:1624](∅→∅),[4.1592]→[4.1592:1624](∅→∅),[4.1624]→[2.1:115](∅→∅),[2.115]→[4.1687:1726](∅→∅),[4.1687]→[4.1687:1726](∅→∅),[4.1726]→[2.116:248](∅→∅),[4.239]→[4.2236:2245](∅→∅),[2.248]→[4.2236:2245](∅→∅),[4.2236]→[4.2236:2245](∅→∅),[4.2268]→[3.139:203](∅→∅),[3.203]→[4.2288:2296](∅→∅),[4.2288]→[4.2288:2296](∅→∅)
local line = State.lines[i]if line.mode == 'text' thentable.insert(event.lines, {mode='text', data=line.data}) -- I've forgotten: should we deepcopy(line.data)?elseif line.mode == 'drawing' thentable.insert(event.lines, {mode='drawing', h=line.h, points=deepcopy(line.points), shapes=deepcopy(line.shapes), pending={}})elseassert(false, ('unknown line mode %s'):format(line.mode))endtable.insert(event.lines, deepcopy(State.lines[i])) - edit in source_undo.lua at line 60
-- deep copy lines without cached stuff like text fragments - replacement in source_undo.lua at line 61[4.1982]→[4.1982:2014](∅→∅),[4.2014]→[4.1558:1590](∅→∅),[4.1590]→[2.253:367](∅→∅),[4.68]→[4.1671:1710](∅→∅),[2.367]→[4.1671:1710](∅→∅),[4.1671]→[4.1671:1710](∅→∅),[4.1710]→[2.368:500](∅→∅),[2.500]→[4.2200:2209](∅→∅),[4.2200]→[4.2200:2209](∅→∅),[4.2209]→[3.2457:2521](∅→∅),[3.2521]→[4.2252:2260](∅→∅),[4.2252]→[4.2252:2260](∅→∅)
local line = State.lines[i]if line.mode == 'text' thentable.insert(event.lines, {mode='text', data=line.data}) -- I've forgotten: should we deepcopy(line.data)?elseif line.mode == 'drawing' thentable.insert(event.lines, {mode='drawing', h=line.h, points=deepcopy(line.points), shapes=deepcopy(line.shapes), pending={}})elseassert(false, ('unknown line mode %s'):format(line.mode))endtable.insert(event.lines, deepcopy(State.lines[i]))