Repository navigation
Reorder sessions by key or by dragging them - #28
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sessions were always listed newest first. They can now be arranged within their project.
K/Jor⇧↑/⇧↓move the selected session on the dashboard and in the sidebar;^g K/^g Jwhile attached.Order; a new session still lands at the top, and an existingstate.jsonopens in today's order.Two commits: the stored order (no visible change on its own), then the keys and the drag.
Checked:
make racepasses 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⇧↑/⇧↓, soK/Jare the dependable keys. A drag cannot scroll the list, and a session never moves to another project.