This required a little more restructuring of Global_state. It's not flat now, it's hierarchical again, but in a different way.
after commit 3d89b8eb9d: post - reply A - reply B - reply C
after commit f9f7dab9b7: post reply A reply B reply C
after this commit: row - col - indent 0 - post - col - indent 1 - reply A - col - indent 2 - reply B - col - indent 1 - reply C
The indents are just invisible rectangles of different widths with 0 height.
One change I had to make was to initialize_editor. Neither luaML and driver load lines from disk, but that's arguably the common scenario to support.
OF4P6TYQA7SUF4N2KPDN7LRTIRNXME2IZJHRLFGF3EMDTWZSGOYAC FHHATD2K3LNFNJ4YKTCHAWKBNB5VSASQR4T6TQ5PK4O433P4FOEQC R5QXEHUIZLELJGGCZAE7ATNS3CLRJ7JFRENMGH4XXH24C5WABZDQC O5GJ6PNNBYHH4X3DU4XOB7IDJ4QEW5KXFETIDUJESBUKJYXBSYYAC 7TQAF4BYIK75EEYCCK7VEUSZHNCWMWIA3HZGQKIILYESUZ5ZZRVQC UGWH4VEHN5G6REWZU6BCXZ57AFU7PGK4MULMMHMJCMEMVVEDH2KAC ZXQ2MMPAOIA4TN3TWMFPXZUL7NUE3EWXLV2JHBQXEINE7WCKFSIQC 7KX3WBFEXMIHNKWNF4NUOBW5HO3PEL3ZEFFMTAXFOQG6V7BYXZ3AC JIBCE66ZTWM5WEHEHNKKTRWBJQSQWBDDWPMOJIJR5Q676OSHYCNAC X7HYGAL2QVKG7M5EMZ2VSH37UYWGE3EPUXYQBJOVL6IGJFZ2I5AAC 6C3UZDESM2HPFIHAW5YIPUV6VXO4YV5DIEY574HUGP2DGOQNUVOAC SUPHTPXYKS4JBDPASHAYA5OBVJ45QT7ZV2HYNTF7OJYOKKS6DW5QC KV64IWA3DKR4FL6E4BIG5SFCRQJ3DZFEJOUELCD5TC7DDVJQ6SWAC 4TL2FLYP36JS4K6QBXZBCFCTIBMIT7OAF7KMAAFGPAF5OWSP4QFAC FBDRJ53NJ5BWDQGU2GWZ6NEYHKCCRD7RODMIG7QQZBRFUB4HR7OAC new_definition = function()if Cursor_node thenCursor_node.show_cursor = falseendtable.insert(Definitions, {type='text',data={''},x=Spawn_point.x, y=Spawn_point.y,width=600,})Viewport.x = Spawn_point.x-30Viewport.y = Spawn_point.y-30Cursor_node = Definitions[#Definitions]Cursor_node.show_cursor = trueendbg=Border_color, -- TODO: bg isn't accurate if obj.drawmode = 'line'
update_font_size = function(n)Font_height = nlove.graphics.setFont(love.graphics.newFont(Font_height))local font = love.graphics.getFont()font:setLineHeight(1.3)Line_height = math.floor(Font_height*1.3)Menu_bar_height = 5 + Line_height + 5endendif Global_state.items thenfor _,item in ipairs(Global_state.items) doedit.update_font_settings(item, n)end
Width = 600
Indent = 20 -- number of pixels to indent replies by
local item = initialize_item(filename)table.insert(out, item)
local item = initialize_item(filename, depth)-- every item is a row consisting of two columns:-- one column of padding and another of textlocal row = cols()table.insert(row.data,{type='rectangle', w=depth*Indent, h=0})table.insert(row.data, item)table.insert(out, row)
for key,node in pairs(Definitions) docompute_layout(node, node.x,node.y, Surface, preserve_screen_top_of_cursor_node)end
compute_layout(Global_state.root, 0,0, Surface, preserve_screen_top_of_cursor_node)