Skip to content

Pressing the "HOME" or "END" keys scrolls instead of moving the cursor #659

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
OrionNebula opened this issue May 30, 2019 · 3 comments
Closed

Comments

@OrionNebula
Copy link

What did you do?

  • Press the "HOME" or "END" key on the keyboard while editing a SQL query

What did you expect to happen?

  • I expected to be able to move the cursor to the beginning or end of the current line

What actually happened?

  • The editor pane scrolled to the beginning or end of the query, but the cursor didn't move

What software versions are you using?

Postico version:
1.5.7

macOS version:
Mojave 10.14.5

@jakob
Copy link
Owner

jakob commented Jun 3, 2019

That's the default behavior of "HOME" and "END" on macOS. They scroll to the top / bottom of the scrollview.

The default keyboard shortcut for moving to the beginning / end of the selected line on macOS is cmd-left arrow or cmd-right arrow. Since macOS also supports a lot of emacs key bindings, ctrl-a and ctrl-e also move to the beginning / end of the current line.

The only text editor that I have installed that uses the jump to beginning/end of line behavior for home/end is VS Code. All other editors that I have tried (Sublime, TextMate, TextEdit, Xcode) have the standard macOS behavior.

While I agree that the standard macOS behavior is not the most useful (I can't recall ever having used home/end keys), I still don't want to deviate from platform standards.

Fortunately, macOS has awesome support for changing default key bindings!

If you place the follwong file in ~/Library/KeyBindings/DefaultKeyBinding.dict you can change the default behavior system wide:

{
/* Remap Home / End to be correct on Mac */
"\UF729"  = "moveToBeginningOfLine:";                   /* Home         */
"\UF72B"  = "moveToEndOfLine:";                         /* End          */
"$\UF729" = "moveToBeginningOfLineAndModifySelection:"; /* Shift + Home */
"$\UF72B" = "moveToEndOfLineAndModifySelection:";       /* Shift + End  */
}

(source of the above: https://gist.github.com/seven1m/199361)

Please note that you need to quit and restart Postico after changing the DefaultKeyBinding.dict file.

@OrionNebula
Copy link
Author

This worked great for me, thanks so much!

@jbird55044
Copy link

Awesome - Thank you!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants