Merge topic 'fix-ccmake-search'

5d7c3c0 ccmake: Fix search with '/'
This commit is contained in:
Brad King 2010-09-21 10:33:08 -04:00 committed by CMake Topic Stage
commit 9da64e7c6b
2 changed files with 7 additions and 12 deletions

View File

@ -902,7 +902,7 @@ void cmCursesMainForm::HandleInput()
this->SearchMode = false; this->SearchMode = false;
if ( this->SearchString.size() > 0 ) if ( this->SearchString.size() > 0 )
{ {
this->JumpToCacheEntry(-1, this->SearchString.c_str()); this->JumpToCacheEntry(this->SearchString.c_str());
this->OldSearchString = this->SearchString; this->OldSearchString = this->SearchString;
} }
this->SearchString = ""; this->SearchString = "";
@ -1076,7 +1076,7 @@ void cmCursesMainForm::HandleInput()
{ {
if ( this->OldSearchString.size() > 0 ) if ( this->OldSearchString.size() > 0 )
{ {
this->JumpToCacheEntry(-1, this->OldSearchString.c_str()); this->JumpToCacheEntry(this->OldSearchString.c_str());
} }
} }
// switch advanced on/off // switch advanced on/off
@ -1191,7 +1191,7 @@ int cmCursesMainForm::LoadCache(const char *)
return r; return r;
} }
void cmCursesMainForm::JumpToCacheEntry(int idx, const char* astr) void cmCursesMainForm::JumpToCacheEntry(const char* astr)
{ {
std::string str; std::string str;
if ( astr ) if ( astr )
@ -1199,18 +1199,14 @@ void cmCursesMainForm::JumpToCacheEntry(int idx, const char* astr)
str = cmSystemTools::LowerCase(astr); str = cmSystemTools::LowerCase(astr);
} }
if ( size_t(idx) > this->NumberOfVisibleEntries ) if(str.empty())
{
return;
}
if ( idx < 0 && str.size() == 0)
{ {
return; return;
} }
FIELD* cur = current_field(this->Form); FIELD* cur = current_field(this->Form);
int start_index = field_index(cur); int start_index = field_index(cur);
int findex = start_index; int findex = start_index;
while ( (findex / 3) != idx ) for(;;)
{ {
if ( str.size() > 0 ) if ( str.size() > 0 )
{ {

View File

@ -122,9 +122,8 @@ protected:
// Remove an entry from the interface and the cache. // Remove an entry from the interface and the cache.
void RemoveEntry(const char* value); void RemoveEntry(const char* value);
// Jump to the cache value with index idx. If string str is // Jump to the cache entry whose name matches the string.
// specified, it will stop on widget that contain that string. void JumpToCacheEntry(const char* str);
void JumpToCacheEntry(int idx, const char* str);
// Copies of cache entries stored in the user interface // Copies of cache entries stored in the user interface
std::vector<cmCursesCacheEntryComposite*>* Entries; std::vector<cmCursesCacheEntryComposite*>* Entries;