step:unroll :: add:append
4PPQU5WW2BHKO32CY24KGQXM6GHZQCIWQYQ2JATKJWYIE3HMMX5QC
end
function command.append_note(rel)
if rel == nil then
rel = 'next'
end
local pane = Surface[Cursor_pane.col][Cursor_pane.row]
local curr_id = pane.id
while true do
initialize_cache_if_necessary(curr_id)
local next_id = Cache[curr_id].links[rel]
if next_id == nil then
break
end
curr_id = next_id
end
local filename = os.date('%Y/%m/%d/%H-%M-%S')
print('creating directory '..Directory..dirname(filename))
local status = love.filesystem.createDirectory(Directory..dirname(filename))
assert(status)
Cache[filename] = {lines={{mode='text', data=''}}, left=0, right=Display_settings.column_width, links={}}
initialize_file_metadata(Cache[filename])
local column = {name=filename}
print('connecting up links')
local new_pane = load_pane_from_file(filename)
Cache[curr_id].links[rel] = new_pane.id
Cache[new_pane.id].links[Opposite[rel]] = curr_id
table.insert(column, new_pane)
table.insert(Surface, Cursor_pane.col+1, column)
Cursor_pane.col = Cursor_pane.col+1
Cursor_pane.row = 1
local col_sx = left_edge_sx(Cursor_pane.col)
if col_sx > Display_settings.x + App.screen.width - Display_settings.column_width then
Display_settings.x = math.max(0, col_sx + Display_settings.column_width + Margin_right + Padding_horizontal - App.screen.width)
Display_settings.y = 0
end
stop_editing_all()
new_pane.editable = true
update_pane_bounds()