fix searching with / and ? keys
This commit is contained in:
101
src/ncmpcpp.cpp
101
src/ncmpcpp.cpp
@@ -2974,9 +2974,14 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else if (Keypressed(input, Key.FindForward) || Keypressed(input, Key.FindBackward))
|
else if (Keypressed(input, Key.FindForward) || Keypressed(input, Key.FindBackward))
|
||||||
{
|
{
|
||||||
if ((current_screen != csHelp && current_screen != csSearcher)
|
if ((current_screen == csHelp
|
||||||
|| (current_screen == csSearcher && !mSearcher->Current().first))
|
|| current_screen == csSearcher
|
||||||
{
|
|| current_screen == csTinyTagEditor
|
||||||
|
|| wCurrent == mEditorTagTypes)
|
||||||
|
&& (current_screen != csSearcher
|
||||||
|
|| mSearcher->Current().first))
|
||||||
|
continue;
|
||||||
|
|
||||||
string how = Keypressed(input, Key.FindForward) ? "forward" : "backward";
|
string how = Keypressed(input, Key.FindForward) ? "forward" : "backward";
|
||||||
found_pos = -1;
|
found_pos = -1;
|
||||||
vFoundPositions.clear();
|
vFoundPositions.clear();
|
||||||
@@ -2991,13 +2996,98 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
ShowMessage("Searching...");
|
ShowMessage("Searching...");
|
||||||
List *mList = reinterpret_cast<Menu<Song> *>(wCurrent);
|
List *mList = reinterpret_cast<Menu<Song> *>(wCurrent);
|
||||||
for (size_t i = (wCurrent == mSearcher ? search_engine_static_options-1 : 0); i < mList->Size(); i++)
|
for (size_t i = (wCurrent == mSearcher ? search_engine_static_options : 0); i < mList->Size(); i++)
|
||||||
{
|
{
|
||||||
string name;
|
string name;
|
||||||
switch (current_screen)
|
switch (current_screen)
|
||||||
{
|
{
|
||||||
case csPlaylist:
|
case csPlaylist:
|
||||||
name = mPlaylist->at(i).toString(Config.columns_in_playlist ? Config.song_columns_list_format : Config.song_list_format);
|
name = mPlaylist->at(i).toString(Config.song_list_format);
|
||||||
|
break;
|
||||||
|
case csBrowser:
|
||||||
|
switch (mBrowser->at(i).type)
|
||||||
|
{
|
||||||
|
case itDirectory:
|
||||||
|
name = mBrowser->at(i).name;
|
||||||
|
break;
|
||||||
|
case itSong:
|
||||||
|
name = mBrowser->at(i).song->toString(Config.song_list_format);
|
||||||
|
break;
|
||||||
|
case itPlaylist:
|
||||||
|
name = Config.browser_playlist_prefix.Str();
|
||||||
|
name += mBrowser->at(i).name;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case csSearcher:
|
||||||
|
name = mSearcher->at(i).second->toString(Config.song_list_format);
|
||||||
|
break;
|
||||||
|
case csLibrary:
|
||||||
|
if (wCurrent == mLibArtists)
|
||||||
|
name = mLibArtists->at(i);
|
||||||
|
else if (wCurrent == mLibAlbums)
|
||||||
|
name = mLibAlbums->at(i).first;
|
||||||
|
else
|
||||||
|
name = mLibSongs->at(i).toString(Config.song_library_format);
|
||||||
|
break;
|
||||||
|
case csPlaylistEditor:
|
||||||
|
if (wCurrent == mPlaylistList)
|
||||||
|
name = mPlaylistList->at(i);
|
||||||
|
else
|
||||||
|
name = mPlaylistEditor->at(i).toString(Config.song_list_format);
|
||||||
|
break;
|
||||||
|
case csTagEditor:
|
||||||
|
if (wCurrent == mEditorLeftCol)
|
||||||
|
name = mEditorLeftCol->at(i).first;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const Song &s = mEditorTags->at(i);
|
||||||
|
switch (mEditorTagTypes->Choice())
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
name = s.GetTitle();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
name = s.GetArtist();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
name = s.GetAlbum();
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
name = s.GetYear();
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
name = s.GetTrack();
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
name = s.GetGenre();
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
name = s.GetComposer();
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
name = s.GetPerformer();
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
name = s.GetDisc();
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
name = s.GetComment();
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
|
if (s.GetNewName().empty())
|
||||||
|
name = s.GetName();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
name = s.GetName();
|
||||||
|
name += " -> ";
|
||||||
|
name += s.GetNewName();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -3032,7 +3122,6 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if (Keypressed(input, Key.NextFoundPosition) || Keypressed(input, Key.PrevFoundPosition))
|
else if (Keypressed(input, Key.NextFoundPosition) || Keypressed(input, Key.PrevFoundPosition))
|
||||||
{
|
{
|
||||||
if (!vFoundPositions.empty())
|
if (!vFoundPositions.empty())
|
||||||
|
|||||||
Reference in New Issue
Block a user