Skip to content

Conversation

@ozankasikci
Copy link
Owner

@ozankasikci ozankasikci commented Oct 9, 2025

  • Add scrolling support to branch selection dialog

Implements viewport-based scrolling for the create worktree dialog to
support browsing through large branch lists in small terminals.

Features:
- Viewport rendering with automatic scroll adjustment during navigation
- Visual scroll indicators ("▲ more above" / "▼ more below")
- Terminal resize detection with scroll position recalculation
- Minimum height validation (15 lines) with error messaging
- Selection always visible with 2-line margin for smooth scrolling

Technical changes:
- Added LineType enum to represent flattened line structure
- Added scroll state tracking (scroll_offset, last_known_height,
  last_known_content_height)
- Implemented ensure_selected_visible() with proper indicator space
  accounting
- Added comprehensive unit tests for scroll logic (8 new tests)
- Dialog auto-closes if terminal resized below minimum height

All 24 interactive tests pass. Supports repositories with 100+ branches
in terminals as small as 15 lines.
@ozankasikci ozankasikci changed the title 001 if the the fix branch selection Oct 9, 2025
Make terminal size query graceful for test environments where
TestBackend doesn't support querying terminal size. Falls back to
a reasonable default height of 24 lines when size() returns an error.

This fixes CI test failures while maintaining runtime behavior.
The CI tests were failing because handle_enter() was using
crossterm::terminal::size() which throws errors in test environments
where TestBackend doesn't support terminal size queries.

Changed to use self.terminal.size().unwrap_or(24) to match the
graceful fallback pattern used in handle_create_key(), providing
a reasonable default height when the terminal size cannot be queried.
@codecov
Copy link

codecov bot commented Oct 9, 2025

Codecov Report

❌ Patch coverage is 89.83051% with 24 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.92%. Comparing base (497d04f) to head (08cd6b9).
⚠️ Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
src/commands/interactive/command.rs 61.53% 10 Missing ⚠️
src/commands/interactive/view.rs 82.92% 7 Missing ⚠️
src/commands/interactive/tests.rs 93.87% 6 Missing ⚠️
src/commands/interactive/dialog.rs 98.59% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #16      +/-   ##
==========================================
+ Coverage   80.38%   80.92%   +0.53%     
==========================================
  Files          15       15              
  Lines        4991     5210     +219     
==========================================
+ Hits         4012     4216     +204     
- Misses        979      994      +15     
Flag Coverage Δ
unit 80.92% <89.83%> (+0.53%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ozankasikci ozankasikci merged commit 5229d07 into master Oct 9, 2025
3 checks passed
@ozankasikci ozankasikci deleted the 001-if-the-the branch October 9, 2025 23:46
@ozankasikci ozankasikci restored the 001-if-the-the branch October 9, 2025 23:53
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