Browse Source

After deleting a song, try to return to the song list near the song
deleted.

Stephen Damm 6 years ago
parent
commit
7193ab63f5
1 changed files with 10 additions and 1 deletions
  1. 10 1
      SongBrowserPlugin/UI/Browser/SongBrowserUI.cs

+ 10 - 1
SongBrowserPlugin/UI/Browser/SongBrowserUI.cs

@@ -573,7 +573,16 @@ namespace SongBrowserPlugin.UI
                     }
                 }
 
-                _model.LastSelectedLevelId = null;
+                int newRow = _model.SortedSongList.FindIndex(x => x.levelID == level.levelID) - 1;
+                if (newRow > 0 && newRow < _model.SortedSongList.Count)
+                {
+                    _model.LastSelectedLevelId = _model.SortedSongList[newRow].levelID;
+                }
+                else
+                {
+                    _model.LastSelectedLevelId = null;
+                }
+
                 SongLoaderPlugin.SongLoader.Instance.RemoveSongWithPath(songPath);
                 this.UpdateSongList();
                 this.RefreshSongList();