Hi,
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.)
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.
Similarly it is impossible to select 'caller(0)' by double-clicking 'caller' and extending to the right, instead one ends up with 'caller(0))['.
Gerd
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).
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
On 18 Dec 2011, at 18:32, Gerd Knops wrote:
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.
You’re saying there are more sequences of non-word characters (excl. whitespace) that should not be considered a single unit, than sequences of non-word characters which are a single unit, making the default behavior suboptimal?
Looking through my current C++ source, what I find is comparison operators (==, !=, <=, >=), algebraic operators (++, --, +=, -=, *=, /=, |=, &=, etc.), logical operators (&&, ||), field accessors (->, .*, ::), empty braces (()), comments (//, /*, */), etc.
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 am not sure I agree with you that your one example shows that your desired behavior is better, as I’m not even sure what you’re requesting to have out-of-the-box (w/o bundle settings) would give what I’d consider optimal unit selection behavior.
Anyway, since you didn’t get the unit selection improvements working correct before today (AFAIK), how about spending some time with the new behavior and then submit some constructive feedback wrt. how it can be improved when you have a more complete picture of where it clashes with your expectations?
On Dec 18, 2011, at 12:53 PM, Allan Odgaard wrote:
On 18 Dec 2011, at 18:32, Gerd Knops wrote:
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.
You’re saying there are more sequences of non-word characters (excl. whitespace) that should not be considered a single unit, than sequences of non-word characters which are a single unit, making the default behavior suboptimal?
Looking through my current C++ source, what I find is comparison operators (==, !=, <=, >=), algebraic operators (++, --, +=, -=, *=, /=, |=, &=, etc.), logical operators (&&, ||), field accessors (->, .*, ::), empty braces (()), comments (//, /*, */), etc.
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 am not sure I agree with you that your one example shows that your desired behavior is better, as I’m not even sure what you’re requesting to have out-of-the-box (w/o bundle settings) would give what I’d consider optimal unit selection behavior.
Anyway, since you didn’t get the unit selection improvements working correct before today (AFAIK), how about spending some time with the new behavior and then submit some constructive feedback wrt. how it can be improved when you have a more complete picture of where it clashes with your expectations?
Fair enough, thanks.
Gerd
On 12/18/11 10:53 AM, Allan Odgaard wrote:
On 18 Dec 2011, at 18:32, Gerd Knops wrote:
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.
You’re saying there are more sequences of non-word characters (excl. whitespace) that should not be considered a single unit, than sequences of non-word characters which are a single unit, making the default behavior suboptimal?
Looking through my current C++ source, what I find is comparison operators (==, !=,<=,>=), algebraic operators (++, --, +=, -=, *=, /=, |=,&=, etc.), logical operators (&&, ||), field accessors (->, .*, ::), empty braces (()), comments (//, /*, */), etc.
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 am not sure I agree with you that your one example shows that your desired behavior is better, as I’m not even sure what you’re requesting to have out-of-the-box (w/o bundle settings) would give what I’d consider optimal unit selection behavior.
Anyway, since you didn’t get the unit selection improvements working correct before today (AFAIK), how about spending some time with the new behavior and then submit some constructive feedback wrt. how it can be improved when you have a more complete picture of where it clashes with your expectations?
Perhaps, Xcode (script/sh file) and BBEdit seem to do what some folks are suggesting here. In comparison Textmate and Avian do different behavior such as what appears to be disagreeable to some. I would prefer the selection to be more BBEdit or XCode when it comes to that perl snippet. die("$self failed to implement ".(caller(0))[3]); I have not looked at C syntax yet.
thx
Hi
I don't see the advantage of including the $ when selecting a variable. Yes sometimes it is very handy to include the $ but other times it is a complete nuisance, especially when creating associative arrays from from pasting a variables name. I guess the perfect solution is pressing shift, double click to include the $ or something along those lines.
My copy of TM2 includes the $ and I really want it to behave like TM1 in this respect. Does anyone know how to make it NOT include the $ when double clicking a variable?
Frankos
Gerd Knops-2 wrote:
Hi,
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.)
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.
Similarly it is impossible to select 'caller(0)' by double-clicking 'caller' and extending to the right, instead one ends up with 'caller(0))['.
Gerd
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
I believe that this is what you want:
http://blog.macromates.com/2012/clever-completion/
(In particular the description of the characterClass property). You should be able to override these settings in your own source bundle, and probably in your PHP bundle.
On Thu, May 10, 2012 at 10:50 AM, Frankos frank.leigh@btopenworld.comwrote:
Hi
I don't see the advantage of including the $ when selecting a variable. Yes sometimes it is very handy to include the $ but other times it is a complete nuisance, especially when creating associative arrays from from pasting a variables name. I guess the perfect solution is pressing shift, double click to include the $ or something along those lines.
My copy of TM2 includes the $ and I really want it to behave like TM1 in this respect. Does anyone know how to make it NOT include the $ when double clicking a variable?
Frankos
Gerd Knops-2 wrote:
Hi,
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.)
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.
Similarly it is impossible to select 'caller(0)' by double-clicking 'caller' and extending to the right, instead one ends up with 'caller(0))['.
Gerd
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
-- View this message in context: http://old.nabble.com/-TM2--selection-behavior-tp32995485p33763669.html Sent from the textmate users mailing list archive at Nabble.com.
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate