feat: lyrics view smooth scrolling, manual browsing, and timing nudge#378
Conversation
Extract the lyrics renderer to src/tui/ui/lyrics.rs, keeping the original bordered centered look. The view now glides between lines (300ms cubic ease on the animation tick), supports manual scrolling (arrows/wheel, page and jump keys) with auto-follow resume via f/Esc or 8s idle, labels synthesized plain-lyrics timing as estimated in the title, and adds a Left/Right timing nudge for misaligned LRC files (offset shown in the title, reset on track change).
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
💤 Files with no reviewable changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThe lyrics view now supports eased scrolling, manual browsing, follow resumption, paging and jump controls, timing nudges, synced-versus-plain lyric indicators, and dedicated rendering with updated UI wiring and tests. ChangesLyrics view
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Player
participant App
participant LyricsView
participant User
Player->>App: update playback tick
App->>LyricsView: advance lyric scroll
User->>LyricsView: browse or nudge timing
LyricsView->>App: update lyrics_view state
App->>LyricsView: render adjusted lyric position
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/infra/network/utils.rs (1)
83-91: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winReset
lyrics_syncedalongsidelyricswhen a new lookup starts.
lyrics_syncedis only written in the two "found" branches below (lines 117, 125). Every other outcome (Loading start here, all NotFound/error branches, and the podcast/nothing-playing paths inrunner.rs) leaves it holding the previous track's value. It's currently invisible because the UI only reads it whenlyrics_status == Found, but resetting it here removes the dependency on that gate ever staying in sync.🧹 Proposed fix
app.lyrics_status = LyricsStatus::Loading; app.lyrics = None; + app.lyrics_synced = false; }🤖 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 `@src/infra/network/utils.rs` around lines 83 - 91, Update the loading-state initialization in the lookup flow to reset app.lyrics_synced alongside app.lyrics when a new request begins. Use the same state update block guarded by desired_lyrics_identity and preserve the existing LyricsStatus::Loading behavior.
🤖 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.
Inline comments:
In `@src/tui/handlers/lyrics_view.rs`:
- Around line 8-10: Update the like-action branch in the lyrics-view key handler
to match app.user_config.keys.like_track instead of the hard-coded 's' key,
while preserving the existing toggle_like_currently_playing_item call.
In `@src/tui/ui/help.rs`:
- Around line 156-170: Update the Lyrics view help rows in the help-screen
builder to derive displayed key values from key_bindings.move_up, move_down,
move_left, and move_right instead of hardcoded arrow labels. Include the
handler-supported Ctrl aliases where applicable, while preserving the existing
descriptions and Lyrics view category.
---
Nitpick comments:
In `@src/infra/network/utils.rs`:
- Around line 83-91: Update the loading-state initialization in the lookup flow
to reset app.lyrics_synced alongside app.lyrics when a new request begins. Use
the same state update block guarded by desired_lyrics_identity and preserve the
existing LyricsStatus::Loading behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: d6421f80-b2b2-4b47-9dae-797a20552179
📒 Files selected for processing (11)
CHANGELOG.mdsrc/core/app.rssrc/infra/network/utils.rssrc/tui/handlers/lyrics_view.rssrc/tui/handlers/mod.rssrc/tui/handlers/mouse.rssrc/tui/runner.rssrc/tui/ui/help.rssrc/tui/ui/lyrics.rssrc/tui/ui/mod.rssrc/tui/ui/player.rs
Summary
Reworks the lyrics view around the existing bordered renderer, now extracted to
src/tui/ui/lyrics.rs:Up/Down(orj/k, mouse wheel) scroll through the lyrics to read ahead or behind. Auto-follow pauses while browsing (browsed line highlighted in the hovered color, hint row at the bottom) and resumes viaf,Esc, or after 8s idle.Ctrl+d/Ctrl+upage 5 lines,Ctrl+a/Ctrl+ejump to first/last line.Esconly closes the view when not browsing;qalways closes.Right/Leftshift lyric timing 0.5s earlier/later per press for misaligned community LRC files. The offset shows in the block title (e.g.Lyrics (offset +2.0s)) and resets on track change.Lyrics (timing estimated)so fake sync is not presented as real.State lives in a new
LyricsViewStateonApp; fetching and sync mechanics are unchanged.Testing
cargo test --no-default-features --features telemetry), including new unit tests for the easing, browse resnap timeout, offset math, and TestBackend render tests for the view states.cargo fmtandcargo clippy -D warningsclean; full-feature and cover-art builds compile.Summary by CodeRabbit