-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Search variables using multiple words #168
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3579,11 +3579,24 @@ void getvarinfo(int n, int types, int notypes, int flags, int noflags, char *str | |
} | ||
if(str && *str) | ||
{ | ||
std::vector<std::string> words; | ||
explodelist(str, words); | ||
static char *laststr = NULL; | ||
if(ids[1].empty() || !laststr || strcmp(str, laststr)) | ||
{ | ||
ids[1].setsize(0); | ||
loopv(ids[0]) if(rigcasestr(ids[0][i]->name, str)) ids[1].add(ids[0][i]); | ||
loopv(ids[0]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please do not use loop macros, instead use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't add that loop macro. I think getting rid of the loop macros is a separate issue for another PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I general we usually just remove them from code we rework/work at. It doesn't hurt anybody |
||
{ | ||
bool matches = true; | ||
for (const std::string &word : words) | ||
{ | ||
if(!rigcasestr(ids[0][i]->name, word.c_str())) | ||
{ | ||
matches = false; | ||
} | ||
} | ||
if(matches) ids[1].add(ids[0][i]); | ||
} | ||
if(laststr) DELETEA(laststr); | ||
laststr = newstring(str); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add a comment that states exactly what this line does, it is not obvious