[TxMt] Re: [TM2] selection behavior

Gerd Knops gerti-textmate at bitart.com
Sun Dec 18 17:32:52 UTC 2011


On Dec 17, 2011, at 7:21 PM, Allan Odgaard wrote:

> On 17 Dec 2011, at 21:34, Gerd Knops wrote:
> 
>> TM2 still appears to have the same troublesome selection behavior TM1 has. As an example take this line in Perl:
>> 
>> 	die("$self failed to implement ".(caller(0))[3]);
>> 
>> Ideally I could select '$self' by double-clicking. For that to work I would need to tell TM2 that $ is a word character in Perl, per grammar word character definitions are needed. (That may be there already, but I can't find it being mentioned anywhere.)
> 
> If I double-click $self it selects the entire thing incl. ‘$’.
> 
> TM2 allows you to set characterClass per scope — the ‘$self’ in your example is scoped as ‘variable.other…’ and in the source bundle we set ‘{ characterClass = 'variable'; }’ for the ‘variable’ scope which means that TM2 will consider that a different unit than the surrounding text (for word movement, selection, etc.)
> 
Perfect. I had an old perl bundle that apparently superseded the new bundle with the TM2 mods.

> 
>> Similarly it is impossible to select 'caller(0)' by double-clicking 'caller' and extending to the right, instead one ends up with 'caller(0))['.
> 
> For me ‘(’ is another unit than ‘0’ but ‘))[’ is all the same unit — though could be changed via grammar rules — that might be cumbersome, but OTOH hardcoding it in TM isn’t exactly any simpler (and less flexible).
> 
I just don't see the sense in combining all "non-word" characters into one unit. The only case where that might make sense is an operator consisting of multiple non-word characters, like the '->' in "oPtr->var" or less-equal/greater-equal operators. And I would assume that the grammar can define those cases.

In all other cases combining all "non-word" characters into one unit when extending a double-click selection is just plain obnoxious behavior, as the above example shows.

I take your word for it that it isn't trivial to change, but it is still going to bug me every day I use TextMate...

Gerd



More information about the textmate mailing list