Repository navigation
fix av switch hiding branches in tall stacks - #796
Conversation
Bubbletea drops the top of any frame taller than the terminal, so in a stack that didn't fit, branches above the cutoff were invisible but still selectable. Scroll the tree to keep the chosen branch on screen, keeping the header and help line visible. Also accept esc to cancel, and show it in the help line.
Current Aviator status
This PR was merged using Aviator (commit 6e88f3e).
See the real-time status of this PR on the
Aviator webapp.
Use the Aviator Chrome Extension
to see the status of your PR within GitHub.
|
✅ FlexReview StatusCommon Owner:
Review SLO: |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe switch view now keeps the selected branch in the visible tree viewport, updates the viewport on navigation and resize, and accepts Escape as a cancel key. The tree renderer can return line ranges for rendered branches. ChangesSwitch view
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant KeyInput
participant SwitchViewModel
participant RenderTreeWithLineRanges
participant TerminalView
KeyInput->>SwitchViewModel: Send selection or resize message
SwitchViewModel->>RenderTreeWithLineRanges: Render tree and collect branch ranges
RenderTreeWithLineRanges-->>SwitchViewModel: Return tree lines and branch ranges
SwitchViewModel->>TerminalView: Display visible tree lines and help bindings
Suggested reviewers: Merge Risk: ⚪ Minimal · up to No confirmed issue blocks merging after normal checks. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Reported on Discord: in a 12-branch stack in a ~20-row terminal,
av switchonly showedav-stack-04and below (and no header), but the hidden branches were still selectable.Bubbletea v2's inline renderer drops the top lines of any frame taller than the terminal, and
av switchrendered the whole tree without handlingWindowSizeMsg. The tree now scrolls to keep the selected branch on screen, with the header and help line always visible. When the tree fits, output is unchanged.Also accepts
escto cancelav switch, and its help line now saysesc cancel. Other prompts are unchanged since they still only accept ctrl+c.Adds
stackutils.RenderTreeWithLineRangesso the view knows which lines each branch occupies;RenderTreeoutput is unchanged.Follow-up, not in this PR:
adopt_tree_selectorlikely has the same tall-tree issue.Tested:
TestSwitchViewScrollsToChosenBranch(fails on master: 41 lines vs a 20-row limit),TestSwitchViewEscCancels, and manually in a 20-row tmux pane with the reported stack.Summary by CodeRabbit