Support responsive height in Playlist Manager and Playlist views#226
Conversation
📝 WalkthroughWalkthroughThis PR adds viewport scroll position tracking to the playlist manager overlay, enabling the UI to anchor the cursor in view during navigation and filter interactions. It extends the playlist manager state with scroll fields, adds measurement and adjustment helpers per screen, integrates scroll management into key handling and the update cycle, and refactors the overlay rendering with shell helpers and inline footer counter logic. ChangesPlaylist Manager Scroll Management
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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 |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
ui/model/keys.go (1)
1588-1619:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winRe-clamp playlist-manager scroll after track removal.
After
case "d"removes a track and updatesm.plManager.tracks, the cursor is re-clamped (lines 1612-1618) butm.plManager.scrollis not. The filter branch is covered becauseplMgrRecomputeFiltercallsplMgrTracksMaybeAdjustScrollinternally, but whenm.plManager.filter == ""the scroll can be left pointing pastlen(tracks)-visible(e.g., deleting the last track while scrolled near the bottom). The viewport then renders blank trailing rows until the next user input.🛠️ Proposed fix
newCount := m.plMgrTracksViewCount() if m.plManager.cursor >= newCount { m.plManager.cursor = newCount - 1 } if m.plManager.cursor < 0 { m.plManager.cursor = 0 } + m.plMgrTracksMaybeAdjustScroll(m.plMgrTracksVisible()) }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@ui/model/keys.go` around lines 1588 - 1619, The removal flow in case "d" updates m.plManager.tracks and re-clamps m.plManager.cursor but never adjusts m.plManager.scroll when m.plManager.filter == "", causing blank trailing rows; fix by invoking the existing scroll-adjust helper (m.plMgrTracksMaybeAdjustScroll()) after updating m.plManager.tracks (or otherwise clamp m.plManager.scroll to the valid range computed from len(tracks) and the visible count), keeping the cursor adjustments as-is; place the call just after setting m.plManager.tracks and after the filter-branch so both filtered and unfiltered paths ensure scroll is valid.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@ui/model/keys.go`:
- Around line 1588-1619: The removal flow in case "d" updates m.plManager.tracks
and re-clamps m.plManager.cursor but never adjusts m.plManager.scroll when
m.plManager.filter == "", causing blank trailing rows; fix by invoking the
existing scroll-adjust helper (m.plMgrTracksMaybeAdjustScroll()) after updating
m.plManager.tracks (or otherwise clamp m.plManager.scroll to the valid range
computed from len(tracks) and the visible count), keeping the cursor adjustments
as-is; place the call just after setting m.plManager.tracks and after the
filter-branch so both filtered and unfiltered paths ensure scroll is valid.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: b8250322-1c7e-4325-9e8e-85519d13986c
📒 Files selected for processing (9)
ui/model/keymap.goui/model/keys.goui/model/overlays.goui/model/scroll.goui/model/state.goui/model/update.goui/model/view_helpers.goui/model/view_nav.goui/model/view_overlays.go
💤 Files with no reviewable changes (1)
- ui/model/view_helpers.go
This PR improves the Playlist Manager and Playlist views by adding support for the expanded-view setting
ctrl+xAdditionally, there are improvements to scrolling behavior, the
helpKeyline to clarify navigation and display the track name next to the 'add' functions, and corrected visibilty #/# status in the playlist views (and keymap).Summary by CodeRabbit
Bug Fixes
Improvements