add: put new pane in current column if possible
This commit is contained in:
parent
acc851413c
commit
164adb0afe
34
commands.lua
34
commands.lua
|
@ -953,12 +953,34 @@ function command.add_note(rel)
|
|||
print('connecting up links')
|
||||
Cache[pane.id].links[rel] = new_pane.id
|
||||
Cache[new_pane.id].links[Opposite[rel]] = pane.id
|
||||
local column = {name=new_pane.id}
|
||||
table.insert(column, new_pane)
|
||||
add_column_to_right_of_cursor(column)
|
||||
refresh_pane_height(pane) -- just in case this is the first link
|
||||
bring_cursor_column_on_screen()
|
||||
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)
|
||||
Cursor_pane.row = #Surface[Cursor_pane.col]
|
||||
add_title(new_pane, ('%d/%d'):format(Cursor_pane.row, Cursor_pane.row))
|
||||
new_pane.editable = true
|
||||
Surface[Cursor_pane.col][Cursor_pane.row] = new_pane
|
||||
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 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)
|
||||
refresh_pane_height(pane) -- just in case this is the first link
|
||||
bring_cursor_column_on_screen()
|
||||
bring_cursor_of_cursor_pane_in_view('up')
|
||||
end
|
||||
plan_draw()
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user