Skip to content

Conversation

@robalni
Copy link
Contributor

@robalni robalni commented Jul 27, 2020

This makes is possible to search using multiple words in the vars menu.
When you do that you will find all variables that contain all of the
specified words in any order.

Examples:

If you search for "weap rifle" you will find:

  • riflefragweap1
  • riflefragweap2
  • weapidxrifle

If you search for "plasma 1" you will find all variables that modify
plasma 1.

This makes is possible to search using multiple words in the vars menu.
When you do that you will find all variables that contain all of the
specified words in any order.

Examples:

If you search for "weap rifle" you will find:
- riflefragweap1
- riflefragweap2
- weapidxrifle

If you search for "plasma 1" you will find all variables that modify
plasma 1.
@robalni
Copy link
Contributor Author

robalni commented Jul 27, 2020

This is the only bug I have found so far: Search for "s s" and you will see that some results will have too many 's'. Similar thing also happens with 'y'. This is probably because 's' and 'y' are used for formatting and then it finds them in the format codes the next time it replaces text.

@MoonPadUSer
Copy link
Contributor

I like the idea

hilvar = (stringreplace $curvar $variable_search_text (format "^fs^fy%1^fS" $variable_search_text))
hilvar = $curvar
looplist variable_search_word $variable_search_text [
hilvar = (stringreplace $hilvar $variable_search_word (format "^fs^fy%1^fS" $variable_search_word))
Copy link
Contributor

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

{
ids[1].setsize(0);
loopv(ids[0]) if(rigcasestr(ids[0][i]->name, str)) ids[1].add(ids[0][i]);
loopv(ids[0])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please do not use loop macros, instead use for (int i = 0; i < ids[0].length(); i++)

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

Copy link
Contributor

Choose a reason for hiding this comment

The 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

This command helps with the multi word var search highlighting.
@robalni
Copy link
Contributor Author

robalni commented Jul 28, 2020

The bug I mentioned about too many 's' is fixed by this last commit d315585

@TheAssassin TheAssassin added this to the 1.7.0 milestone Dec 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants