Krolyxon
Commit 6af7553

rmptui6af7553

highlight current playing songs in lists

Author
krolxon
Date
2024-05-10 22:50 +0530
Parent
0c8cfe3
Commit
6af7553fc87a90fe7591452d4550545f38af936a

+3 −2

1 file changed

  1. M src/ui.rs +3 −2
M src/ui.rs View
@@ -145,7 +145,7 @@ fn draw_directory_browser(frame: &mut Frame, app: &mut App, size: Rect) {
145145
146146 /// draws playing queue
147147 fn draw_queue(frame: &mut Frame, app: &mut App, size: Rect) {
148− let rows = app.queue_list.list.iter().map(|song| {
148+ let rows = app.queue_list.list.iter().enumerate().map(|(i, song)| {
149149 // metadata
150150 let title = song.clone().title.unwrap_or_else(|| song.clone().file);
151151 let artist = song.clone().artist.unwrap_or_default().cyan();
@@ -175,7 +175,8 @@ fn draw_queue(frame: &mut Frame, app: &mut App, size: Rect) {
175175 Cell::from(time.to_string().magenta()),
176176 ]);
177177
178− if song.file.contains(&app.conn.current_song.file) {
178+ let pos = app.conn.current_song.place.unwrap_or_default().pos;
179+ if i == pos as usize {
179180 row.magenta().bold()
180181 } else {
181182 row