Parenthesize selected expression

Issue #501 closed
Former user created an issue

Originally reported on Google Code with ID 501

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.

Reported by ivycarp on 2014-04-23 14:00:18

Comments (12)

  1. Former user Account Deleted
    Good suggestion, thank you. Will keep this in the loop for the next release.
    

    Reported by helder.pereira.correia on 2014-04-27 05:04:08 - Status changed: Accepted - Labels added: Type-Enhancement, Priority-Medium, Milestone-0.12, Component-UI, Usability

  2. Former user Account Deleted
    Added in revision 7dd5028. The feature is triggered with Control-P. If no selection
    is present, the entire expression will be wrapped.
    

    Reported by helder.pereira.correia on 2014-05-04 04:09:46 - Status changed: Fixed

  3. Former user Account Deleted
    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! :)
    

    Reported by ivycarp on 2014-05-04 09:02:10

  4. Former user Account Deleted
    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).
    

    Reported by ivycarp on 2014-05-04 09:04:15

  5. Former user Account Deleted
    > "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.
    

    Reported by helder.pereira.correia on 2014-05-04 17:29:43

  6. Former user Account Deleted
    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.
    

    Reported by ivycarp on 2014-05-06 02:45:33

  7. Former user Account Deleted
    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.
    

    Reported by helder.pereira.correia on 2014-05-06 07:00:42

  8. Former user Account Deleted
    Right, didn't think of that :P works for me and makes sense, thanks :)
    

    Reported by ivycarp on 2014-05-07 14:34:31

  9. Former user Account Deleted
    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)
    
    :-)
    

    Reported by EgorAdroppov on 2015-02-01 20:55:55

  10. Log in to comment