Could the View -> Show Invisible Characters be made to apply in the Global Find dialog, especially in the Find and Replace fields? There are times when not knowing there's a space can really really screw up your global replacement (ask me how I know that!)...
Thx - m.
-- matt neuburg, phd = http://www.apeth.net/matt/ pantes anthropoi tou eidenai oregontai phusei Programming iOS 9! http://shop.oreilly.com/product/0636920044352.do iOS 9 Fundamentals! http://shop.oreilly.com/product/0636920044345.do RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
On 3 Sep 2016, at 2:38, Matt Neuburg wrote:
Could the View -> Show Invisible Characters be made to apply in the Global Find dialog, especially in the Find and Replace fields?
This is non-trivial since the Find and Replace fields are system controls, so we’d need to override system behavior to try and achieve this (not something I have looked into, but in general customizing NSTextField is not easy).
There are times when not knowing there's a space can really really screw up your global replacement (ask me how I know that!)...
Is that a space in the Replace field? The current nightly build uses a different background color for matches, that way, one can see if leading/trailing space is being matched.
On Sep 4, 2016, at 2:32 AM, Allan Odgaard mailinglist@textmate.org wrote:
On 3 Sep 2016, at 2:38, Matt Neuburg wrote:
Could the View -> Show Invisible Characters be made to apply in the Global Find dialog, especially in the Find and Replace fields?
This is non-trivial since the Find and Replace fields are system controls
Okay. How about in the display of what the replaced results will look like? We seem to be in control of that, right enough.
m.
-- matt neuburg, phd = http://www.apeth.net/matt/ pantes anthropoi tou eidenai oregontai phusei Programming iOS 9! http://shop.oreilly.com/product/0636920044352.do iOS 9 Fundamentals! http://shop.oreilly.com/product/0636920044345.do RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
On 5 Sep 2016, at 17:18, Matt Neuburg wrote:
This is non-trivial since the Find and Replace fields are system controls
Okay. How about in the display of what the replaced results will look like? We seem to be in control of that, right enough.
Correct, the search results are (in theory) possible to customize however we want.
Though I am not sure what problem we are trying to solve here.
Was the problem with a trailing space in the replace text field? Or possible two spaces when only one was desired?
Would you want the “Show Invisibles” limited to only the match/replacement string (in the search results)? As I assume if we render all invisibles, it’ll look rather busy.
As mentioned earlier, the current nightlies have a background color for the match/replacement, I’ve attached a capture where I put 3 trailing spaces in the replace field. To be honest, I am not sure rendering them as dots in the search results would make it that much clearer, that there is too much space (but then, I also use a monospaced font for search results).
On Sep 9, 2016, at 3:11 AM, Allan Odgaard mailinglist@textmate.org wrote:
Would you want the “Show Invisibles” limited to only the match/replacement string (in the search results)? As I assume if we render all invisibles, it’ll look rather busy.
Well, I work with "Show Invisibles" turned on all the time, and I regard this as useful and normal, not "busy". It's one of TextMate's indispensable features! So I don't imagine that things would look all that different with "Show Invisibles" applied to the search results. Maybe my imagination is failing here, but I don't see what would be wrong with rendering all of them.
Personally, I find the bold-plus-background-color in the screen shot "busy". But perhaps I'll feel differently when it comes along in the regular releases and I actually use it.
You asked about the use case. I think what happened was that there was a space in the replace field left over from a previous search. I couldn't see it so I didn't know it was there. Thus I thought my global find-and-replace was about to delete all the seach targets but it actually replaced them with a space. This mistake was surprisingly tricky to recover from. Clearly the background color _would_ have helped me catch this, because I would have seen blocks of background color where I was expecting to see nothing!
(Even then, though, the onus would have been on me to click in the Replace field so as to get the replaced version of the search results. That is why I was hoping we could show spaces in the search and replace fields themselves.)
m.
-- matt neuburg, phd = http://www.apeth.net/matt/ pantes anthropoi tou eidenai oregontai phusei Programming iOS 9! http://shop.oreilly.com/product/0636920044352.do iOS 9 Fundamentals! http://shop.oreilly.com/product/0636920044345.do RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
On 9 Sep 2016, at 16:39, Matt Neuburg wrote:
You asked about the use case. I think what happened was that there was a space in the replace field left over from a previous search. I couldn't see it so I didn't know it was there. Thus I thought my global find-and-replace was about to delete all the seach targets but it actually replaced them with a space. This mistake was surprisingly tricky to recover from. Clearly the background color _would_ have helped me catch this, because I would have seen blocks of background color where I was expecting to see nothing!
I see, as you hint yourself, showing invisibles in the replacement preview would not necessarily have caught this, it really needs to be indicated in the replace text field.
Come to think of it, it might actually be possible to show invisibles in the fields with a “data formatter” that returns an attributed string as the “string value”.
I’m not entirely sold on this solution though, but I’ve added a note about it :)
On Sep 14, 2016, at 12:19 AM, Allan Odgaard mailinglist@textmate.org wrote:
On 9 Sep 2016, at 16:39, Matt Neuburg wrote:
You asked about the use case. I think what happened was that there was a space in the replace field left over from a previous search. I couldn't see it so I didn't know it was there. Thus I thought my global find-and-replace was about to delete all the seach targets but it actually replaced them with a space. This mistake was surprisingly tricky to recover from. Clearly the background color _would_ have helped me catch this, because I would have seen blocks of background color where I was expecting to see nothing!
I see, as you hint yourself, showing invisibles in the replacement preview would not necessarily have caught this, it really needs to be indicated in the replace text field.
Come to think of it, it might actually be possible to show invisibles in the fields with a “data formatter” that returns an attributed string as the “string value”.
I’m not entirely sold on this solution though, but I’ve added a note about it :)
Cool, thanks! m.
-- matt neuburg, phd = http://www.apeth.net/matt/ pantes anthropoi tou eidenai oregontai phusei Programming iOS 9! http://shop.oreilly.com/product/0636920044352.do iOS 9 Fundamentals! http://shop.oreilly.com/product/0636920044345.do RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
On Sep. 14, 2016, at 1:19 am, Allan Odgaard mailinglist@textmate.org wrote:
Come to think of it, it might actually be possible to show invisibles in the fields with a “data formatter” that returns an attributed string as the “string value”. I’m not entirely sold on this solution though, but I’ve added a note about it :)
If it’s at all possible, it would also be quite handy for the Find dialog to use a different colour for special characters like backslashes, or * ? (), etc. with regexes.
Thanks, David
On 22 Sep 2016, at 2:32, David Green wrote:
If it’s at all possible, it would also be quite handy for the Find dialog to use a different colour for special characters like backslashes, or * ? (), etc. with regexes.
If you hold option and Check for Updates then beta 12.15 will syntax highlight both the search and replace strings (when regular expression is enabled).
For the search string it uses the Regular Expressions (Oniguruma) grammar in the TextMate bundle and for the replace string, the Format String grammar is used (also from the TextMate bundle).
The coloring comes from the Mac Classic theme but this can be changed via the `UIThemeUUID` defaults key.
The “show invisibles” feature is unfortunately a bit more involved, since we are only allowed to add “attributes” to the edited string (during editing), and there doesn’t seem to be any attribute to make invisible characters visible.
We can however do this when the field is inactive, since here we are allowed to change the string.
On Sep. 25, 2016, at 9:35 am, Allan Odgaard mailinglist@textmate.org wrote:
For the search string it uses the Regular Expressions (Oniguruma) grammar in the TextMate bundle and for the replace string, the Format String grammar is used (also from the TextMate bundle).
Fantastic! I no longer have to go cross-eyed when working on a regex with lots of escaped and unescaped brackets.
Thanks very much, David