Skip to content

Reorder sessions by key or by dragging them - #28

Merged
tdwd merged 2 commits into
mainfrom
reorder-sessions
Nov 17, 2026
Merged

tdwd merged 2 commits into
mainfrom
reorder-sessions

Conversation

@tdwd

@tdwd tdwd commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Sessions were always listed newest first. They can now be arranged within their project.

  • K/J or ⇧↑/⇧↓ move the selected session on the dashboard and in the sidebar; ^g K/^g J while attached.
  • Drag a session row, in the sidebar or the dashboard list, onto another row of the same project. Each step is saved.
  • Each session stores an Order; a new session still lands at the top, and an existing state.json opens in today's order.

Two commits: the stored order (no visible change on its own), then the keys and the drag.

Checked: make race passes on the committed tree. Each guard was removed in turn and a test went red. An independent review found a redraw and a crash guard with no test, both now covered. Not tried in a real terminal; some terminals and tmux setups do not send ⇧↑/⇧↓, so K/J are the dependable keys. A drag cannot scroll the list, and a session never moves to another project.

tdwd added 2 commits November 17, 2026 09:46
Sessions were listed newest first by CreatedAt, so there was no order
to change. Each session now holds an Order, lowest first. A new one
takes its negated creation time, which is below every session created
before it, so the list still opens newest first. Load fills the same
value into a file written before Order existed.

MoveSession puts a session at a position in its project's list by
handing the project's existing values back out in the new sequence, so
a later session still sorts first. Equal values, from a hand-edited
file, are raised apart first so a move cannot report success and move
nothing. Nothing calls it yet.
K and J, or shift+up and shift+down, move the selected session one step
within its project: the dashboard's session list when it has focus, the
sidebar in the session view, and ^g K / ^g J while attached. At either
end the footer says so rather than doing nothing.

A press on a session row, in the sidebar or the dashboard list, starts
a drag. Motion with the left button held moves the session onto the row
under the pointer, if that row is in the same project, and saves at
every step, because a button let go outside the window may send no
release. Any key or press ends a drag. Once the session has moved, the
starting press no longer counts toward a double click, since its row
now holds another session.

Both go through moveSession, which saves, redraws the sidebar, and puts
both cursors back on the sessions they were on rather than on the row
index they held.
@tdwd
tdwd merged commit 8d725da into main Nov 17, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant