From 6be91a8216fae1026191b7e023288425657014e9 Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Sun, 8 Mar 2009 17:45:28 +0100 Subject: improve searching a bit / fix going to previous found position --- src/menu.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/menu.h') 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 size_t NCurses::Menu::RealChoice() const template bool NCurses::Menu::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 void NCurses::Menu::PrevFound(bool wrap) return; std::set::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()); } -- cgit v1.2.3