Jump over collapsed projects when reordering sessions#255
Merged
Conversation
Reordering a session over a collapsed project (C-x C-n / C-x C-p) previously swapped it with each hidden member one keypress at a time, so the session appeared to get stuck inside the collapsed project. A movable session is always in a visible region (ungrouped or an expanded group), so the only collapsed groups it meets are adjacent regions it would step into. Add collapse-aware region helpers and use them at move boundaries so the session jumps the whole collapsed project in one step, landing at the edge of the next visible region. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Problem
In the TUI session view, reordering a session over a collapsed project (
C-x C-n/C-x C-p, orShift+Up/Shift+Down) swapped the session with each hidden member of that project one keypress at a time. Because the project's members are hidden, the session appeared to get "stuck" inside the collapsed project for several keypresses before emerging on the other side.Fix
The reorder logic lives in the daemon (
move_session), not the TUI. At a region boundary a session would enter the adjacent group and then swap through its members.A movable session is always in a visible region (ungrouped, or an expanded group) — you can't select a session hidden inside a collapsed group — so the only collapsed groups a moved session ever meets are the adjacent regions it would step into. The fix is therefore localized to the boundary step:
group_collapsedplusregion_above_skipping_collapsed/region_below_skipping_collapsed, which loop past collapsed groups and return the first visible region in the move direction.move_sessionnow uses these at region boundaries.Net effect: moving a session toward a collapsed project jumps the entire project in one step, landing at the top/bottom edge of the next visible region instead of interleaving with hidden members. If the only thing in the move direction is a collapsed group (e.g. it's the last group), the move is a no-op rather than burying the session inside it — to drop a session into a collapsed project, expand it first.
Test
Added
move_session_jumps_over_collapsed_projectcovering the down-jump (ungrouped → past collapsed group → top of next expanded group, collapsed members untouched) and the symmetric up-jump back to the ungrouped region.No protocol/client/TUI changes — the collapsed state is already authoritative on the daemon (TUI collapse toggle persists via
set_project_collapsed→set_group_collapsed).🤖 Generated with Claude Code