local column = {name=new_pane.id}
table.insert(column, new_pane)
add_column_to_right_of_cursor(column)
bring_cursor_of_cursor_pane_in_view('up')
if #Surface[Cursor_pane.col] == 1 then
-- column has a single note; turn it into unroll
Surface[Cursor_pane.col] = {name=('%s from %s'):format(rel, pane.id)}
populate_unroll_column(Surface[Cursor_pane.col], pane.id, rel) -- invalidates new_pane
Cursor_pane.row = #Surface[Cursor_pane.col]
Surface[Cursor_pane.col][Cursor_pane.row].editable = true
bring_cursor_column_on_screen()
bring_cursor_of_cursor_pane_in_view('down')
elseif string.match(Surface[Cursor_pane.col].name, rel..' from %S+') then
-- we're unrolling along the same rel; just append to it
-- (we couldn't be inserting in the middle if we didn't return earlier in
-- the function)
table.insert(Surface[Cursor_pane.col], new_pane)
Cursor_pane.row = #Surface[Cursor_pane.col]
add_title(new_pane, ('%d/%d'):format(Cursor_pane.row, Cursor_pane.row))
refresh_pane_height(pane) -- just in case this is the first link
bring_cursor_column_on_screen()
bring_cursor_of_cursor_pane_in_view('down')
else
local column = {name=new_pane.id}
table.insert(column, new_pane)
add_column_to_right_of_cursor(column)
bring_cursor_of_cursor_pane_in_view('up')
end