Skip to content

Commit dfad7e7

Browse files
program247365claude
andcommitted
feat(tui): show [l] Loop in the footer menu when it applies
Appears between Favorite and Played on playlist tracks only — hidden on plain single tracks (already looping) and while a solo loop is engaged (only n/b exit), so the menu never advertises a dead key. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 53b4643 commit dfad7e7

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

src/tui.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,7 @@ fn draw_normal_in(frame: &mut ratatui::Frame, area: ratatui::layout::Rect, state
819819

820820
draw_scatter(frame, chunks[1], state, true);
821821
draw_progress(frame, chunks[2], state);
822-
draw_footer(frame, chunks[3]);
822+
draw_footer(frame, chunks[3], state);
823823

824824
// Render the stateful image last so its mutable borrow of state.thumbnail
825825
// doesn't conflict with the immutable borrows above.
@@ -1295,19 +1295,30 @@ fn draw_progress(frame: &mut ratatui::Frame, area: ratatui::layout::Rect, state:
12951295

12961296
// ── Footer ────────────────────────────────────────────────────────────────────
12971297

1298-
fn draw_footer(frame: &mut ratatui::Frame, area: ratatui::layout::Rect) {
1299-
let text = vec![Line::from(vec![
1298+
fn draw_footer(frame: &mut ratatui::Frame, area: ratatui::layout::Rect, state: &AppState) {
1299+
let mut spans = vec![
13001300
Span::styled("[Space]", Style::default().fg(Color::Rgb(255, 160, 50))),
13011301
Span::raw(" Pause/Resume "),
13021302
Span::styled("[f]", Style::default().fg(Color::Rgb(255, 160, 50))),
13031303
Span::raw(" Fullscreen "),
13041304
Span::styled("[s]", Style::default().fg(Color::Rgb(255, 160, 50))),
13051305
Span::raw(" Favorite "),
1306+
];
1307+
// `l` only means something on a playlist track that isn't already the loop.
1308+
if state.is_playlist && !state.solo_loop {
1309+
spans.push(Span::styled(
1310+
"[l]",
1311+
Style::default().fg(Color::Rgb(255, 160, 50)),
1312+
));
1313+
spans.push(Span::raw(" Loop "));
1314+
}
1315+
spans.extend([
13061316
Span::styled("[p]", Style::default().fg(Color::Rgb(255, 160, 50))),
13071317
Span::raw(" Played "),
13081318
Span::styled("[q]", Style::default().fg(Color::Rgb(255, 160, 50))),
13091319
Span::raw(" Quit"),
1310-
])];
1320+
]);
1321+
let text = vec![Line::from(spans)];
13111322

13121323
let block = Block::default()
13131324
.borders(Borders::ALL)

0 commit comments

Comments
 (0)