[REVIEW ONLY] Add Find Whole Word functionality#8310
Conversation
|
Thanks @SAplayer, working on the icon now. |
|
@TomMalbran @SAplayer that got me thinking. When "Match Case" and "Regex" are both on would "Match Case" affect the regex results? |
|
@larz0 You can't have both on. That is why a dropdown will work well here. |
|
@TomMalbran I'll need to think about it. If we want to use a drop down then we'll need to figure out a way to show the options that are being turned on. |
|
@larz0 Sure. Maybe it can be a dropdown with icons. The currently selected one is both the displayed one and with the lightblue background and the one with a checkmark in the list. The card linked here also includes toggles for prefix of word and suffix of word, no implemented here but that could be eventually added to the same dropdown. |
|
@TomMalbran sounds like we can definitely group "Whole word", "Prefix" and "Suffix" into a drop down :) |
|
@larz0 That can work too. So for now we can use an icon and we can add the dropdown once the others are implemented. |
|
Here you go @SAplayer http://cl.ly/0T3C1d0H3M1Y Should just work once you replace the old sprite with this one. |
|
@TomMalbran cool sounds good. |
Yes, you can. The "Match Case" setting remove the But, "Find Whole Word" and "Regex" are mutually exclusive. Maybe that's what you meant. |
|
@redmunds Yes, that is what I mean. I just read it as "Whole Word" and "Regex" since we are in this PR |
|
@redmunds @TomMalbran In that case then it makes sense to make the "Regex" button a drop down button with "whole word", "prefix" and "suffix" in the menu. |
|
@larz0 So should I wait until we've got these extra two buttons (prefix/suffix) or implement the dropdown right now? |
|
@SAplayer we could implement the drop-down now. I thought about it last night and realized that we need a third option that's the default option. We could call it "Any" for now but let me know if you can think of a better label. What do you think @TomMalbran? |
|
I'd imagine it like this:
|
|
@SAplayer what's "Further Options"? Maybe we can use a Filter icon for "None". Looks good! |
|
I thought of "Further Options" as a header for the menu (bold and delimited). |
|
I see. Maybe it's ok to leave that out if the drop-down's default icon is obvious. I'll work on the additional icons that we'll need. |
|
Note to self: The "Whole Word" toggle should influence the "Find All and select" (Alt+F3 currently) behaviour, too. See #8473 (comment) |
|
Seems to work. Can you merge master into this branch. Let us know when there are unit tests for this. |
|
@JeffryBooher This PR is not yet ready. We need a dropdown to contain all those new flags. |
|
Closing in favor of #9526. |
New version of #7604.
This PR implements https://trello.com/c/xabJJVcu/1078-find-replace-whole-word-toggle.
It doesn't have an icon yet, but you can use it without restrictions.
To be done:
The things I tested worked the same as in Sublime Text, but I found one scenario where it didn't work the way it works in Visual Studio:
if ("abc")abcNeither Brackets nor Sublime find anything, but VS does. We'd probably need regexp lookbefores in order to fix this, but those are not supported in JavaScript.