diff options
author | Andrzej Rybczak <electricityispower@gmail.com> | 2009-03-08 17:45:28 +0100 |
---|---|---|
committer | Andrzej Rybczak <electricityispower@gmail.com> | 2009-03-08 17:45:28 +0100 |
commit | 6be91a8216fae1026191b7e023288425657014e9 (patch) | |
tree | 95d0f16a98043906f33528ac0bd869093f4e47b5 /src/menu.h | |
parent | 2c30387a91870052364cee3bdbd6526d5e3dd514 (diff) |
improve searching a bit / fix going to previous found position
Diffstat (limited to 'src/menu.h')
-rw-r--r-- | src/menu.h | 7 |
1 files changed, 2 insertions, 5 deletions
@@ -599,6 +599,7 @@ template <class T> size_t NCurses::Menu<T>::RealChoice() const template <class T> bool NCurses::Menu<T>::Search(const std::string &constraint, size_t beginning, bool case_sensitive) { itsFound.clear(); + itsSearchConstraint.clear(); if (constraint.empty()) return false; itsSearchConstraint = constraint; @@ -631,11 +632,7 @@ template <class T> void NCurses::Menu<T>::PrevFound(bool wrap) return; std::set<size_t>::iterator prev = itsFound.lower_bound(itsHighlight); if (prev != itsFound.begin()) - { - if (*prev == size_t(itsHighlight)) - prev--; - Highlight(*prev); - } + Highlight(*--prev); else if (wrap) Highlight(*itsFound.rbegin()); } |