Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Additional vertical controls for hardware keyboards

Users of hardware keyboards currently have available:

  • alt + left/right to move the cursor left/right by word.
  • cmd + left/right to move the cursor to the start/end of the line.
  • cmd + up/down to move the cursor to the top/bottom of the file.

A few extra controls for vertical movement would be helpful, for example:

  • alt + up/down to move the cursor to the previous/next blank line.
  • fn + up/down to move the cursor up/down a whole page.

Comments

  • SimeonSimeon Admin Mod
    Posts: 4,829

    @alteous I've never heard of those two shortcuts, how do they work in more detail? I don't think they exist on macOS or iOS.

    alt+down on macOS is supposed to move the cursor down one line but place it at the end of the line. alt+up moves the cursor up one line but places it at the beginning of the line. Just noticed these don't work correctly in Codea.

    There is no fn key on the standard iPad keyboard, but I like the basic idea. Perhaps we can extend it to be more specific to coding? alt+cmd+up/down jumps to the cursor to the first line of the next function or method.

  • alt+up/down has no effect for me (iPad 2, iOS 9.3).

    MacBooks tend to have the fn key; see the MacBook Pro for example. That's besides the point though: fn+up/down is meant to have the same effect as page up/down, which would be useful. At the moment I have to reach for the screen to scroll through long files (first world problems). :smile:

  • SimeonSimeon Admin Mod
    Posts: 4,829

    @alteous yeah I can see a need for it, just wondering if jumping by function wouldn't be more useful? Also we would need to map it to something other than the fn key.

  • Posts: 21

    Not sure, it's a personal preference. Where would the caret be placed when jumping between functions?

    1: Left of function keyword.

    |function foo()
    ...
    end
    

    2: Start of first line.

    function foo()
    |   local bar = 123
    ...
    end
    

    3: End of function signature.

    function foo()|
       local bar = 123
    ...
    end
    

    4: Something else?

    Alt+up/down is usually a jump between blank lines:

    |
    function foo()
        local bar = 123
    |
        return bar
    end
    |
    function baz()
    ...
    end
    |
    

    Page up/down is usually a jump by the number of lines visible on the screen.

  • SimeonSimeon Admin Mod
    Posts: 4,829

    I was thinking end of function signature, or start of first line (but after any whitespace / indentation). It would be interesting to re-think some standard text navigation shortcuts to be more catered to coding.

    Interesting, alt+up/down on macOS gives me jumping up/down one line but constrained to start/end of line depending on direction.

Sign In or Register to comment.