sanchahar / speedcrunch

Automatically exported from code.google.com/p/speedcrunch
1 stars 0 forks source link

Parenthesize selected expression #501

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
It would be very useful to be able to select and expression and place it in 
parenthesis through a hotkey or the right-click context menu (or a key 
combination). I realize the context menu isn't really used so a hotkey would be 
adequate. I just find myself using complex expressions where I need to enforce 
the precedence of operations and having to pixel-hunt to place parenthesis is a 
bit tedious sometimes.

Original issue reported on code.google.com by ivyc...@gmail.com on 23 Apr 2014 at 2:00

GoogleCodeExporter commented 8 years ago
Good suggestion, thank you. Will keep this in the loop for the next release.

Original comment by helder.p...@gmail.com on 27 Apr 2014 at 5:04

GoogleCodeExporter commented 8 years ago
Added in revision 7dd5028. The feature is triggered with Control-P. If no 
selection is present, the entire expression will be wrapped.

Original comment by helder.p...@gmail.com on 4 May 2014 at 4:09

GoogleCodeExporter commented 8 years ago
Wow, thanks! I guess all I had to do was ask :P

One thing though. Control-P is a highly discoverable key combo, but not very 
usable. Unless I'm mistaken, there is no hotkey reference, so I'm going with 
what the menus indicate are the available key combinations and I think, since 
it's available, Control-Q or something in that area would be a lot better.

If one selects an expression it will either be:

1. With the mouse, thus probably with the right hand, making Control-P a 
difficult combination if it has to be done in quick succession/repeatedly with 
the left hand, since the right-side control is sort of "reverse" to the letter 
key used (in other words, the user will likely have to use their thumb, which 
is uncommon and uncomfortable imho). A more comfortable combination would be on 
the left side of the keyboard, akin to copy-paste and selection operations.
2. With Control-A, to select and expression and parenthesize before adding more 
expressions. Control-P here is on the other side and would optimally use the 
right hand, but it is completely reverse, requiring both hands, which is 
counter-intuitive when the majority of such operations (again, copy-paste and 
select) are done one-handed on the left side.

I understand the suggestion of Control-Q instead might seem like a bad idea due 
to lower discoverability (since users, if aware that a feature exists or when 
they suspect it exists, will naturally and justifiably first try a combination 
of Control or Alt and the first letter of the word of the operation, in this 
case P) but this is a feature few would expect in the first place, thus the 
most likely case is that they will discover it through the changelog or menu, 
in which case discoverability value becomes somewhat irrelevant. Thus I propose 
Control-Q (or something in the area) that is easy to use with Control-A and 
easy to use with the left hand, since this is likely to be an operation that 
will be done in quick succession (if parenthesizing expressions in a cascade, 
in an effort to break up a larger expression) or will be done while using only 
the keyboard (which is part of speedcrunch's goal after all).

Anyway, thanks for the quick addition, no matter the key combo, this will make 
using speedcrunch a _lot_ easier! :)

Original comment by ivyc...@gmail.com on 4 May 2014 at 9:02

GoogleCodeExporter commented 8 years ago
Thinking of it, control-P is excellent for left-handed users, but there is no 
left-handed hotkey scheme available. Perhaps have both but in different hotkey 
schemes, like ctrl-q for righties and ctrl-p for lefties (unlikely to be added 
I know, but just putting it here as food for thought).

Original comment by ivyc...@gmail.com on 4 May 2014 at 9:04

GoogleCodeExporter commented 8 years ago
> "the most likely case is that they will discover it through the changelog or 
menu"

This reminds me that I had actually planned to add a menu entry in Edit. I'll 
take care of that. That will help with discoverability.

> "the user will likely have to use their thumb"

Hmm, I always use my left-hand thumb for all shortcuts. Not sure why anyone 
would use another finger to press Control :)

> "control-P is excellent for left-handed users"

I'm right-handed and I find it perfect, both using the keyboard only, and 
combined with the mouse. The Control key that exists on most (all?) keyboards 
to the right of the spacebar serves exactly that purpose - allow people to 
choose the Control key that serves them best. That said, I think I should also 
look into adding the command to the context menu of the editor.

Original comment by helder.p...@gmail.com on 4 May 2014 at 5:29

GoogleCodeExporter commented 8 years ago
I guess it's too much to ask for configurable hotkeys too at this point huh :P

I can see where you're coming from on this, it's probably that I have quite 
different habits on how I use my left hand (I prefer it rested so it only goes 
to the middle of the keyboard for Enter and I only ever use my thumb for Space 
and Alt, never for Ctrl, I use my pinky for that - gaming habits :P).

I just don't want to lose the sweet, sweet Ctrl+A -> Ctrl+Q combo :P because 
that's how I imagined it, but it's probably ok either way.

Original comment by ivyc...@gmail.com on 6 May 2014 at 2:45

GoogleCodeExporter commented 8 years ago
You don't need to press Ctrl-A because Ctrl-P will wrap the whole expression if 
there is ni selection. Ctrl-Q is reserved for Session > Quit.

Original comment by helder.p...@gmail.com on 6 May 2014 at 7:00

GoogleCodeExporter commented 8 years ago
Right, didn't think of that :P works for me and makes sense, thanks :)

Original comment by ivyc...@gmail.com on 7 May 2014 at 2:34

GoogleCodeExporter commented 8 years ago
combinations inconvenient, by default, in other applications
Ctrl-P => Print
Ctrl-Q => Quit

you need something relevant to the brackets, so it's easier to remember, for 
example
Ctrl-0(zero)

:-)

Original comment by EgorAdro...@gmail.com on 1 Feb 2015 at 8:55