diff --git a/src/browser.cpp b/src/browser.cpp index 374c265d..5555f894 100644 --- a/src/browser.cpp +++ b/src/browser.cpp @@ -74,7 +74,6 @@ void Browser::SwitchTo() if (hasToBeResized) Resize(); - CLEAR_FIND_HISTORY; w->Empty() ? myBrowser->GetDirectory(itsBrowsedDir) : myBrowser->UpdateItemList(); myScreen = this; redraw_header = 1; @@ -97,7 +96,6 @@ void Browser::EnterPressed() { case itDirectory: { - CLEAR_FIND_HISTORY; GetDirectory(item.name, itsBrowsedDir); redraw_header = 1; break; diff --git a/src/clock.cpp b/src/clock.cpp index 590ae34f..8cd3118a 100644 --- a/src/clock.cpp +++ b/src/clock.cpp @@ -83,7 +83,6 @@ void Clock::SwitchTo() if (hasToBeResized) Resize(); - CLEAR_FIND_HISTORY; myScreen = this; myPlaylist->Main()->Hide(); redraw_header = 1; diff --git a/src/global.h b/src/global.h index 654229b0..f83896bf 100644 --- a/src/global.h +++ b/src/global.h @@ -53,9 +53,6 @@ namespace Global extern bool redraw_header; extern std::string volume_state; - - extern std::vector vFoundPositions; - extern int found_pos; } #endif diff --git a/src/media_library.cpp b/src/media_library.cpp index 3e52849f..8cd890d0 100644 --- a/src/media_library.cpp +++ b/src/media_library.cpp @@ -112,7 +112,6 @@ void MediaLibrary::SwitchTo() if (hasToBeResized) Resize(); - CLEAR_FIND_HISTORY; myScreen = this; redraw_header = 1; Refresh(); @@ -128,7 +127,6 @@ void MediaLibrary::Update() { if (Artists->Empty()) { - CLEAR_FIND_HISTORY; TagList list; Albums->Clear(0); Songs->Clear(0); @@ -284,7 +282,6 @@ void MediaLibrary::GetSelectedSongs(MPD::SongList &v) void MediaLibrary::NextColumn() { - CLEAR_FIND_HISTORY; if (w == Artists) { if (Songs->Empty()) @@ -307,7 +304,6 @@ void MediaLibrary::NextColumn() void MediaLibrary::PrevColumn() { - CLEAR_FIND_HISTORY; if (w == Songs) { Songs->HighlightColor(Config.main_highlight_color); diff --git a/src/menu.h b/src/menu.h index 4a80d357..9e8bd1c3 100644 --- a/src/menu.h +++ b/src/menu.h @@ -21,6 +21,8 @@ #ifndef _MENU_H #define _MENU_H +#include + #include "window.h" #include "strbuffer.h" #include "misc.h" @@ -52,6 +54,11 @@ namespace NCurses void ReverseSelection(size_t = 0); bool Deselect(); + virtual bool Search(const std::string &, size_t = 0, bool = 0) = 0; + virtual const std::string &GetSearchConstraint() = 0; + virtual void NextFound(bool) = 0; + virtual void PrevFound(bool) = 0; + virtual void ApplyFilter(const std::string &, size_t = 0, bool = 0) = 0; virtual const std::string &GetFilter() = 0; virtual std::string GetOption(size_t) = 0; @@ -119,6 +126,11 @@ namespace NCurses virtual size_t Choice() const; virtual size_t RealChoice() const; + virtual bool Search(const std::string &constraint, size_t beginning = 0, bool case_sensitive = 0); + virtual const std::string &GetSearchConstraint() { return itsSearchConstraint; } + virtual void NextFound(bool wrap); + virtual void PrevFound(bool wrap); + virtual void ApplyFilter(const std::string &filter, size_t beginning = 0, bool case_sensitive = 0); virtual const std::string &GetFilter(); virtual std::string GetOption(size_t pos); @@ -170,11 +182,13 @@ namespace NCurses void *itsGetStringFunctionUserData; std::string itsFilter; + std::string itsSearchConstraint; std::vector