[TxMt] Re: [TM2] selection behavior
Allan Odgaard
mailinglist at textmate.org
Sun Dec 18 01:21:28 UTC 2011
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.)
> Now double-clicking on 'self' and moving the mouse to the left to add the '$' doesn't work because it adds '("$'. TM2 should treat non-word characters as individual characters instead of grouping them together into a "word" when extending a selection that started with a double-click.
Sounds like you may have a local source bundle that eclipse the default one or similar.
> 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).
More information about the textmate
mailing list