diff --git a/doc/ncmpcpp_keys b/doc/ncmpcpp_keys index 7e348efd..a886a80d 100644 --- a/doc/ncmpcpp_keys +++ b/doc/ncmpcpp_keys @@ -115,6 +115,8 @@ # #key_toggle_auto_center = 'U' # +#key_go_to_containing_directory = 'G' +# #key_go_to_parent_dir = 263 127 # #key_quit = 'q' 'Q' diff --git a/src/ncmpcpp.cpp b/src/ncmpcpp.cpp index 1d4ad7e0..05027da8 100644 --- a/src/ncmpcpp.cpp +++ b/src/ncmpcpp.cpp @@ -295,7 +295,8 @@ int main(int argc, char *argv[]) sHelp->Add(" [b]Keys - Search engine\n -----------------------------------------[/b]\n"); sHelp->Add(DisplayKeys(Key.Enter) + "Add item to playlist and play/change option\n"); - sHelp->Add(DisplayKeys(Key.Space) + "Add item to playlist\n\n\n"); + sHelp->Add(DisplayKeys(Key.Space) + "Add item to playlist\n"); + sHelp->Add(DisplayKeys(Key.GoToContainingDir) + "Go to directory containing found item\n\n\n"); sHelp->Add(" [b]Keys - Media library\n -----------------------------------------[/b]\n"); sHelp->Add(DisplayKeys(&Key.VolumeDown[0], 1) + "Previous column\n"); @@ -1836,6 +1837,17 @@ int main(int argc, char *argv[]) ShowMessage("Cannot read file!"); } } + else if (Keypressed(input, Key.GoToContainingDir)) + { + if (wCurrent == mSearcher && !vSearched.empty() && mSearcher->GetChoice() > search_engine_static_option) + { + GetDirectory(vSearched[mSearcher->GetChoice()-search_engine_static_option-1]->GetDirectory()); + for (int i = 1; i < mBrowser->MaxChoice(); i++) + if (mSearcher->GetCurrentOption() == mBrowser->GetOption(i)) + mBrowser->Highlight(i); + goto SWITCHER_BROWSER_REDIRECT; + } + } else if (Keypressed(input, Key.GoToPosition)) { if (now_playing < 0) diff --git a/src/settings.cpp b/src/settings.cpp index f1acd3f3..d6bd4a25 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -77,6 +77,7 @@ void DefaultKeys(ncmpcpp_keys &keys) keys.Add[0] = 'a'; keys.SavePlaylist[0] = 'S'; keys.GoToNowPlaying[0] = 'o'; + keys.GoToContainingDir[0] = 'G'; keys.ToggleAutoCenter[0] = 'U'; keys.GoToParentDir[0] = 263; keys.Quit[0] = 'q'; @@ -131,6 +132,7 @@ void DefaultKeys(ncmpcpp_keys &keys) keys.Add[1] = null_key; keys.SavePlaylist[1] = null_key; keys.GoToNowPlaying[1] = null_key; + keys.GoToContainingDir[1] = null_key; keys.ToggleAutoCenter[1] = null_key; keys.GoToParentDir[1] = 127; keys.Quit[1] = 'Q'; @@ -380,6 +382,8 @@ void ReadKeys(ncmpcpp_keys &keys) GetKeys(*it, keys.GoToNowPlaying); else if (it->find("key_toggle_auto_center ") != string::npos) GetKeys(*it, keys.ToggleAutoCenter); + else if (it->find("key_go_to_containing_directory ") != string::npos) + GetKeys(*it, keys.GoToContainingDir); else if (it->find("key_go_to_parent_dir ") != string::npos) GetKeys(*it, keys.GoToParentDir); else if (it->find("key_quit ") != string::npos) diff --git a/src/settings.h b/src/settings.h index ac3ffc3e..477bf2c2 100644 --- a/src/settings.h +++ b/src/settings.h @@ -79,6 +79,7 @@ struct ncmpcpp_keys int Add[2]; int SavePlaylist[2]; int GoToNowPlaying[2]; + int GoToContainingDir[2]; int ToggleAutoCenter[2]; int GoToParentDir[2]; int Quit[2];