diff --git a/src/help.cpp b/src/help.cpp index d166bd2e..6aeacdff 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -249,6 +249,7 @@ void Help::GetKeybindings() *w << DisplayKeys(Key.GoToNowPlaying) << "Locate currently playing song\n"; *w << DisplayKeys(Key.GoToParentDir) << "Go to parent directory\n"; *w << DisplayKeys(Key.Delete) << "Delete playlist/file/directory\n"; + *w << DisplayKeys(Key.GoToContainingDir) << "Jump to playlist editor (playlists only)\n"; *w << "\n\n " << fmtBold << "Keys - Search engine\n -----------------------------------------\n" << fmtBoldEnd; diff --git a/src/ncmpcpp.cpp b/src/ncmpcpp.cpp index 7ff4b35a..8eb1dc4f 100644 --- a/src/ncmpcpp.cpp +++ b/src/ncmpcpp.cpp @@ -1588,9 +1588,17 @@ int main(int argc, char *argv[]) } else if (Keypressed(input, Key.GoToContainingDir)) { - Song *s = myScreen->CurrentSong(); - if (s) - myBrowser->LocateSong(*s); + if (myScreen == myBrowser && myBrowser->Main()->Current().type == itPlaylist) + { + const std::string pl_name = myBrowser->Main()->Current().name; + myPlaylistEditor->JumpTo(pl_name); + } + else + { + Song *s = myScreen->CurrentSong(); + if (s) + myBrowser->LocateSong(*s); + } } else if (Keypressed(input, Key.GoToMediaLibrary)) { diff --git a/src/playlist_editor.cpp b/src/playlist_editor.cpp index 2554cb60..df186486 100644 --- a/src/playlist_editor.cpp +++ b/src/playlist_editor.cpp @@ -289,6 +289,20 @@ void PlaylistEditor::ApplyFilter(const std::string &s) GetList()->ApplyFilter(s, 0, REG_ICASE | Config.regex_type); } +void PlaylistEditor::JumpTo(const std::string &s) +{ + SwitchTo(); + for (size_t i = 0; i < Playlists->Size(); ++i) + { + if (s == (*Playlists)[i]) + { + Playlists->Highlight(i); + Content->Clear(); + break; + } + } +} + List *PlaylistEditor::GetList() { if (w == Playlists) diff --git a/src/playlist_editor.h b/src/playlist_editor.h index baadecb1..48bd9809 100644 --- a/src/playlist_editor.h +++ b/src/playlist_editor.h @@ -46,6 +46,8 @@ class PlaylistEditor : public Screen virtual void GetSelectedSongs(MPD::SongList &); virtual void ApplyFilter(const std::string &); + + virtual void JumpTo(const std::string &); virtual List *GetList();