Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ pub struct App {
pub selected_album_full: Option<SelectedFullAlbum>,
pub selected_device_index: Option<usize>,
pub selected_playlist_index: Option<usize>,
pub active_playlist_index: Option<usize>,
pub size: Rect,
pub small_search_limit: u32,
pub song_progress_ms: u128,
Expand Down Expand Up @@ -368,6 +369,7 @@ impl Default for App {
song_progress_ms: 0,
selected_device_index: None,
selected_playlist_index: None,
active_playlist_index: None,
track_table: Default::default(),
episode_table: Default::default(),
user: None,
Expand Down
1 change: 1 addition & 0 deletions src/handlers/playlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ pub fn handler(key: Key, app: &mut App) {
if let (Some(playlists), Some(selected_playlist_index)) =
(&app.playlists, &app.selected_playlist_index)
{
app.active_playlist_index = Some(selected_playlist_index.to_owned());
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my look through the codebase, there is no other way in which we enter into the TableContext::MyPlaylists context, so this is all that is necessary to track the "active" playlist.

app.track_table.context = Some(TrackTableContext::MyPlaylists);
app.playlist_offset = 0;
if let Some(selected_playlist) = playlists.items.get(selected_playlist_index.to_owned()) {
Expand Down
7 changes: 3 additions & 4 deletions src/handlers/track_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,10 +320,9 @@ fn on_enter(app: &mut App) {
Some(context) => match context {
TrackTableContext::MyPlaylists => {
if let Some(_track) = tracks.get(*selected_index) {
let context_uri = match (&app.selected_playlist_index, &app.playlists) {
(Some(selected_playlist_index), Some(playlists)) => {
if let Some(selected_playlist) =
playlists.items.get(selected_playlist_index.to_owned())
let context_uri = match (&app.active_playlist_index, &app.playlists) {
(Some(active_playlist_index), Some(playlists)) => {
if let Some(selected_playlist) = playlists.items.get(active_playlist_index.to_owned())
{
Some(selected_playlist.uri.to_owned())
} else {
Expand Down