summaryrefslogtreecommitdiff
path: root/src/menu.h
diff options
context:
space:
mode:
authorAndrzej Rybczak <electricityispower@gmail.com>2009-03-08 17:45:28 +0100
committerAndrzej Rybczak <electricityispower@gmail.com>2009-03-08 17:45:28 +0100
commit6be91a8216fae1026191b7e023288425657014e9 (patch)
tree95d0f16a98043906f33528ac0bd869093f4e47b5 /src/menu.h
parent2c30387a91870052364cee3bdbd6526d5e3dd514 (diff)
improve searching a bit / fix going to previous found position
Diffstat (limited to 'src/menu.h')
-rw-r--r--src/menu.h7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/menu.h b/src/menu.h
index 5527f247..2c73a786 100644
--- a/src/menu.h
+++ b/src/menu.h
@@ -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());
}