Skip to content

feat(tui): H, M and L jump through the Queue and Stats lists - #654

Merged
LargeModGames merged 1 commit into
LargeModGames:mainfrom
kapok-4o:feat/hml-queue-stats
Sep 29, 2026
Merged

LargeModGames merged 1 commit into
LargeModGames:mainfrom
kapok-4o:feat/hml-queue-stats

Conversation

@kapok-4o

@kapok-4o kapok-4o commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Fixes #542. Adds the three H/M/L arms, following recently_played.rs:

  • Queue popup: row 0 is the "Now playing" header, so H selects 0, M selects (row_count(app) - 1) / 2, and L selects row_count(app) - 1.
  • Stats: H/M/L move app.view.stats_selected_track over stats_data.top_tracks with the on_*_press_handler helpers, and do nothing without stats data.
  • Only app.view cursors move, nothing is dispatched. The Stats tests grow top_tracks through app.stats_data.as_mut(), so no new app.<field> = line under src/tui/handlers.

Tests: l_selects_the_last_queue_row (["A", "B", "C"] → row 3), h_selects_the_now_playing_row_and_m_the_middle_row, l_selects_the_last_top_track_and_h_the_first, m_selects_the_middle_top_track.

The changelog line is under ### Fixed, since the help menu already offered these keys; I didn't want to start an ### Added section that #543 would also start.

Testing

  • cargo fmt --all -- --check: clean
  • cargo clippy --no-default-features --features telemetry,tui -- -D warnings: clean
  • cargo test --no-default-features --features telemetry,tui: 1332 passed, 0 failed
  • ... queue_menu and ... stats list the new tests
  • With the new arms disabled, all four new tests fail.

Additional notes

This is one of five small PRs I opened together (for #544, #607, #546, #542 and #543). I test-merged all five in three orders without conflicts; together they pass the slim checks (1333 tests).

Written with AI coding assistants: Claude Code wrote each change on current main against the issue text and checked it (Codex had drafted fixes earlier, used here only as a reference).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Pressing H, M, or L now jumps to the top, middle, or bottom of the Queue popup and the Stats “Top Tracks” list. In the Queue, H selects the “Now playing” row.

The help menu offers H/M/L for top, middle and bottom, but the Queue
popup and the Stats Top Tracks list ignored them. Add the three arms,
following recently_played.rs. The Queue counts its now-playing header
row through row_count, so H selects it and L the last queued item.
Only the view cursors move; nothing is dispatched.

Fixes LargeModGames#542

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: LargeModGames/spotatui/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: ef7d29af-38de-442a-a804-ca160cb0e07a

📥 Commits

Reviewing files that changed from the base of the PR and between a2a538f and 186334e.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • src/tui/handlers/queue_menu.rs
  • src/tui/handlers/stats.rs

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The Queue and Stats handlers now support H, M, and L navigation. Queue navigation includes the “Now playing” row. Tests cover selection in three-item lists, and the changelog records the behavior.

Changes

Queue and Stats list navigation

Layer / File(s) Summary
H/M/L handler behavior and tests
src/tui/handlers/queue_menu.rs, src/tui/handlers/stats.rs, CHANGELOG.md
The Queue handler maps H, M, and L to the first, middle, and last rows. The Stats handler updates the selected track through the corresponding key-event helpers. Tests cover selection in three-item lists. The changelog documents the navigation.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to 18633

H, M, and L navigation appears mergeable after normal checks; no unresolved behavior issue is established.

Architecture Summary

Architecture risk: 🟡 Medium · up to 18633

The change affects 2 systems.

Changed systems: src, CHANGELOG.md

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — src (service) was modified; 2 changed files map to changed impact.
  • observed — CHANGELOG.md (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in CHANGELOG.md: Added a changelog item documenting H, M and L list navigation in Queue and Stats “Top Tracks”, with Queue’s H targeting the “Now playing” row.
  • observed — Modified behavior in src/tui/handlers/queue_menu.rs: handler now handles high, middle, and low navigation events, selecting index 0, (row_count(app) - 1) / 2, and row_count(app) - 1, respectively.
  • observed — Modified behavior in src/tui/handlers/queue_menu.rs: Adds tests asserting that low selects the last row and that high selects the now-playing row while middle selects index 1 for a three-item queue.
  • observed — Modified behavior in src/tui/handlers/stats.rs: Added handling for high, middle, and low selection keys. High sets the selected track through the high-press helper when stats data exists; middle and low update the selection using the top tracks and their respective helpers when stats data is available.

Reliability and maintainability

  • inferred — Risk-relevant change factors for src: blast_radius_2; blast_radius_3; direct_dependents_2; direct_dependents_3
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title uses the existing conventional-commit prefix feat(tui):, clearly describes the Queue and Stats navigation change, and remains concise.
Linked Issues check ✅ Passed Issue [#542] requires H/M/L navigation in Queue and Stats Top Tracks, use the common helpers, account for the Queue header, update only view cursors, and add tests. queue_menu.rs maps H to 0, M to `…
Out of Scope Changes check ✅ Passed The changes stay within issue [#542]. The Queue and Stats handler updates implement the requested navigation. The added tests verify the requested behavior. The changelog entry documents the same beha…
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
✨ Simplify code
  • Create a new PR

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.

❤️ Share

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

@codecov

codecov Bot commented Sep 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@LargeModGames
LargeModGames merged commit e2c3352 into LargeModGames:main Sep 29, 2026
31 checks passed
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.

Support H / M / L (top, middle, bottom) on the Queue and Stats screens

2 participants