We can double-click a left parenthesis to select everything from there to the corresponding right parenthesis, and vice versa, so this raises the question: how does my bundle opt in to this? For example, in my "language" (AsciiDoc), a plus sign might be a delimiter. Is there a way to set things up so that double-clicking a plus sign selects to the other plus sign?
I tried smartTypingPairs and highlightPairs, but neither of those was it...
Thx (and sorry if this has already been explained and I missed it) - 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
It looks like highlightPairs is what this functionality ties into, but I couldn’t make it work with any pairs that were the same; so ["+","+"] didn’t work but ["+","-"] did.
Though my C foo is not good;
It looks like the opener character matching the closing character prevents the range from being generated because it matches the opening character.
If the query is "+ foo +" the search starts and stops on the first +.
If what I’m reading is correct, this might be as simple as starting "from + 1" when looking up the next result.
But I’m probably wrong, lol.
https://github.com/textmate/textmate/commit/2dd825515e343a036172859492e25abf...
Thanks,
Graham Heath
On August 25, 2016 at 4:44:32 PM, Matt Neuburg (matt@tidbits.com) wrote:
We can double-click a left parenthesis to select everything from there to the corresponding right parenthesis, and vice versa, so this raises the question: how does my bundle opt in to this? For example, in my "language" (AsciiDoc), a plus sign might be a delimiter. Is there a way to set things up so that double-clicking a plus sign selects to the other plus sign?
I tried smartTypingPairs and highlightPairs, but neither of those was it...
Thx (and sorry if this has already been explained and I missed it) - m.
On 26 Aug 2016, at 2:49, Graham Heath wrote:
If what I’m reading is correct, this might be as simple as starting "from + 1" when looking up the next result.
But I’m probably wrong, lol.
The problem is with things like: `+foo+ and +bar+`.
If you double-click the second `+` then how to know if we should search left or right for the paired character?
We could look at surrounding whitespace, but then there is `(+foo+)` with no whitespace around. So we could look at word characters, but then `"` is also a paired character and we have things like: `printf("%s…", arg);` where neither side of the first `"` has whitespace or wordcharacters.
That said, I’ve made a note about this, I think we could do a heuristic based on the above thinking that should get it right most of the time, and it would actually be awesome to have ⇧⌘B work in strings.
Though right now there is “Select Current Scope” which works to select the current “unit”, this might also be helpful in determining whether to search left/right of `+foo+`, assuming the grammar matches this.
On Aug 28, 2016, at 11:03 PM, Allan Odgaard mailinglist@textmate.org wrote:
Though right now there is “Select Current Scope”
Well, and in fact what I was trying to select by double-clicking the "+" _is_ a scope.
So maybe the double-clicking thing could be extended to mean, "if what's being double-clicked is a scope-boundary, select the scope". I guess I was subconsciously hoping that that's what it might mean.
Obviously we don't _need_ such a feature, since Select Current Scope exists. But it would be cool as an extension of the delimiter double-clicking (which is already cool).
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 29 Aug 2016, at 17:51, Matt Neuburg wrote:
Well, and in fact what I was trying to select by double-clicking the "+" _is_ a scope.
So maybe the double-clicking thing could be extended to mean, "if what's being double-clicked is a scope-boundary, select the scope"
This is sort of possible by making a “character class” setting for the scope.
But this then affects everything that works on words, e.g. moving word left/right, selecting word, etc., will also treat it as one unit, which is often undesured.
Another possibility is to overload mouse clicks for this scope, right now we only have the ability to overload single-click, you’d need to create a new macro with:
scope selector: comment & dyn.modifier.option semantic class: callback.mouse-click content: ( { command = 'selectCurrentScope:'; } )
This macro will trigger whenever option-clicking inside a comment and it’ll do a “select current scope”, hence this is a way to select the entire comment.
You’d replace `comment` in the above with the scope of your `+foo+` units.
I can probably add `callback.mouse-doubleclick` which would get rid of the option modifier requirement.