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BT2FAVHC6MCAC
N45SAKABARONIN3EJ3N5WOJENSDCQVE43JRI5IYXK7DVUJ34A3SAC
5HOB5Y6ZDNJ42XMHQ7YWZTUCK4DAJRPYRECDWTKFSXZWQ4ZMMSNAC
OFRW3WZELPPJFDDEUVITJKYEBYHCK6HQ3QT2CCYOPSQQZSOC2EKAC
UGEB2N5EVBSHMMJNDKYEHFYH2HHXEHJK3UWSXZB4BCVQR2N65OAAC
JTDPO5WTXYGCACS6OGKLW4NV2XEDOVZK3UED3FAWCB242ZPGLKWAC
AOVGO4PFCRRXU3JPQIVW36UPY6HAGMAH3HHA3E3J7QYZGDYA4B6QC
RTG3J32S5SQX6KC74FFHSK2MAJCMISFUHANSDCIFQA7TGDGDORGAC
MEBSNDGI2LWI56TYXWDQCAVNZOKJRQVVIFPNWHSIHK2A2B2QWKSAC
VHWC2IGQD72ZZUIONIAEP45KPMPX2N6DXN6NU2QGBIWDUHP7INAAC
4A6GJRVUV7PVB62QCNDN7RN6NBHEDN6XPUFJXX22G2OCGNKLCTCAC
4R6FTCNUKS6IDJLNESSHZNPT5BNNZ64OEL3RBFCCZFZNP5OUSBQAC
V6JHPHYNDGOBF3OKHPYJ6IQEU5PSLWNUCQBGVW4TG7TYL6OLF3QAC
JQVKQLX3UAKKWRCBOMLBTQIVXRGJQDLSKXMNXFUSURJVYHY2ULPAC
GQBUV2XOMEPMTXMPCBQWGGIUXGQDX77VTGPFIG6YT7G64ASOYHXQC
function derive_file_height(file)
local y = 0
file.line_cache = {}
for i=1,#file.lines do
local line = file.lines[i]
if line.mode == 'text' then
file.line_cache[i] = {}
Text.compute_fragments(file, i)
Text.populate_screen_line_starting_pos(file, i)
y = y + Line_height*#file.line_cache[i].screen_line_starting_pos
Text.clear_screen_line_cache(file, i)
elseif line.mode == 'drawing' then
-- nothing
y = y + Drawing.pixels(line.h, Display_settings.column_width) + Drawing_padding_height
else
print(line.mode)
assert(false)
end
end
if file.links and not empty(file.links) then
y = y + 5+Line_height+5 -- for crosslinks
end
file.height = y
end
Cache[id] = {id=id, filename=Directory..id, lines={{mode='text', data=''}}, line_cache={{}}, left=0, right=Display_settings.column_width, links={}, height=Line_height}
Cache[id] = {id=id, filename=Directory..id, lines={{mode='text', data=''}}, line_cache={{}}, left=0, right=Display_settings.column_width, links={}}