Skip to content

fix(sidebar): compact session tree slot spacing#90

Merged
bnema merged 1 commit into
mainfrom
fix/sidebar-compact-tree-spacing
Jun 18, 2026
Merged

fix(sidebar): compact session tree slot spacing#90
bnema merged 1 commit into
mainfrom
fix/sidebar-compact-tree-spacing

Conversation

@bnema

@bnema bnema commented Jun 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • remove the extra gap between tree branch glyphs and slotted session numbers
  • keep metadata indentation and mouse click bounds aligned with compact prefix math
  • update documented sidebar examples

Verification

  • rtk go test ./internal/adapters/uity
  • rtk git diff --check

Summary by CodeRabbit

  • Documentation

    • Updated the sidebar layout diagram in the README to reflect the latest tree/slot spacing.
  • Style

    • Improved tree session rendering to use branch-aware compact prefix spacing, including tighter alignment between tree guide glyphs and slot numbers.
  • Tests

    • Added coverage for session-name click bounds when compact slot spacing is enabled.
    • Updated rendering expectations in tree-render tests to match the new compact formatting.

@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 09ee3c97-dda7-4b06-9550-79646386f1df

📥 Commits

Reviewing files that changed from the base of the PR and between 2e44d99 and 3ead82b.

📒 Files selected for processing (5)
  • README.md
  • internal/adapters/uity/sidebar_model_test.go
  • internal/adapters/uity/sidebar_mouse.go
  • internal/adapters/uity/tree_render.go
  • internal/adapters/uity/tree_render_test.go

📝 Walkthrough

Walkthrough

Introduces compactSlotAfterTreeBranch, a helper that removes the space between tree guide characters (├─, └─) and slot numbers. sessionBodyPrefixWidth gains a branch parameter, renderSession, fitSessionName, and metadataNameIndent are refactored to use it, sessionNameClickBounds caches the branch for hit-testing, and tests plus the README example are updated accordingly.

Changes

Branch-aware compact slot spacing

Layer / File(s) Summary
Branch-aware rendering helpers and session row layout
internal/adapters/uity/tree_render.go
Adds compactSlotAfterTreeBranch(slot, branch) helper; extends sessionBodyPrefixWidth with a branch parameter; renderSession, fitSessionName, and metadataNameIndent each compute the branch once and delegate trimming/indent decisions to the new helper.
Click bounds for compact slots
internal/adapters/uity/sidebar_mouse.go, internal/adapters/uity/sidebar_model_test.go
sessionNameClickBounds stores treeBranch(item) in a local variable and passes it to metadataDisplayWidth for the start offset; new test asserts compact-slot click bounds (start=5, end=9) for a last-child slot-2 item.
Updated render test assertions
internal/adapters/uity/tree_render_test.go
Four existing test assertions updated from └─ 1 / ├─ 10 to └─1 / ├─10, and one metadata indent reduced by one space to match the new layout.
README sidebar layout diagram
README.md
Sidebar layout ASCII example updated to reflect pi-coding-agent placement and revised spacing around the separator and Default/scratch subtree.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • bnema/tmux-session-sidebar#64: Introduces category-first tree_render and tree tests; this PR further refactors the same branch/guide/slot spacing logic and updates the same test expectations.
  • bnema/tmux-session-sidebar#68: Modifies tree_render.go rendering paths and tree_render_test.go expectations around tree-guide and current-session marker spacing, overlapping directly with this PR's compact-slot layout changes.
  • bnema/tmux-session-sidebar#87: Modifies sessionNameClickBounds-style calculations and sidebar interaction geometry tests, the same code path updated in this PR.

Poem

🐇 Hop, hop — the spaces flee,
└─1 now snuggles tight, you see!
Branch and slot, compact and neat,
No gap between the guide-mark feat.
The rabbit trimmed the whitespace free! ✂️

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'fix(sidebar): compact session tree slot spacing' directly and clearly summarizes the main change—removing extra gaps between tree branch glyphs and slot numbers in the sidebar layout.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/sidebar-compact-tree-spacing

Comment @coderabbitai help to get the list of available commands and usage tips.

@bnema bnema force-pushed the fix/sidebar-compact-tree-spacing branch 2 times, most recently from 5d385fe to 3ead82b Compare June 18, 2026 11:30
@bnema bnema merged commit e0279bf into main Jun 18, 2026
4 checks passed
@bnema bnema deleted the fix/sidebar-compact-tree-spacing branch June 18, 2026 11:55
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