Skip to content

Commit

Permalink
case insensitive substring search for names. refs #5270
Browse files Browse the repository at this point in the history
  • Loading branch information
namdre committed Mar 18, 2019
1 parent 626085a commit cc0ce14
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/utils/gui/windows/GUIDialog_GLObjChooser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,20 @@ GUIDialog_GLObjChooser::onCmdClose(FXObject*, FXSelector, void*) {

long
GUIDialog_GLObjChooser::onChgText(FXObject*, FXSelector, void*) {
int id = myList->findItem(myTextEntry->getText(), -1, SEARCH_PREFIX);
int id = -1;
if (myLocateByName) {
// findItem does not support substring search
const int numItems = myList->getNumItems();
FXString t = myTextEntry->getText().lower();
for (int i = 0; i < numItems; i++) {
if (myList->getItemText(i).lower().find(t) >= 0) {
id = i;
break;
}
}
} else {
id = myList->findItem(myTextEntry->getText(), -1, SEARCH_PREFIX);
}
if (id < 0) {
if (myList->getNumItems() > 0) {
myList->deselectItem(myList->getCurrentItem());
Expand Down

0 comments on commit cc0ce14

Please sign in to comment.