Move a session to another folder from the menu #7
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Membership lives in exactly one place: each folder's
sessionslist key, withscratch-sessionsfor unfiled sessions(
docs/spec/session-model.md). The model exposes:Both are unit-tested, including moving between folders and clamping a position
past the end.
The gap
The sidebar's context menu offers only Move Up and Move Down, which call
shift_sessionand therefore move a session within the list it is already in.There is no way to move a session into another folder, or out of one to
Scratch, from the UI.
move_session's cross-folder path is reachable only fromtests.
Dragging a row would also do it, but that needs the sidebar replaced with a
hand-built list — see issue #1. This issue is the menu, which is worth having
regardless: a keyboard user should not need to drag anything.
Approach
Add a Move to folder ▸ submenu to the session context menu, built in
session_menu()incrates/terminalko/src/window.rs. It has to be built perrow rather than once, because it needs the target folder and the session:
connect_setup_menustores the session inimp.menu_target— so the action can take just the folder id and act ontarget_session(), exactly assession-colourdoes today;win.session-move-to(folder_id), where an empty string means Scratch;offer a move that does nothing.
Position: appending to the end of the target list is the obvious behaviour
(
move_session(id, folder, usize::MAX)clamps).Acceptance criteria
menu, and the new place survives a restart.
session, or lose its selection — membership is the only thing that changes.
changes.
./build-aux/ci.shand./build-aux/smoke.shpass;docs/spec/session-sidebar.mdmentions the submenu.
Notes
Store::move_sessionalready detaches from wherever the session was, so nobookkeeping is needed beyond calling it and rebuilding the sidebar.
CONTRIBUTING.mdapply.