polar icon indicating copy to clipboard operation
polar copied to clipboard

Ctrl-e doesn't work in editor

Open birkjernstrom opened this issue 5 months ago • 4 comments

Ctrl-a works to get to the beginning of the line, but Ctrl-e is bound to creating backticks, e.g ` `. So we're overwriting a OS-wide text input keybinding currently.

Thanks for @eval for sharing this feedback ♥️🙏🏼

birkjernstrom avatar Feb 01 '24 19:02 birkjernstrom

Hmm 🤔 From what I know, Ctrl + E is not standard (on Windows, it centers text, on Mac, it was used to eject CD 😂).

Actually, we just copied what GitHub does, which uses this shortcut for backticks: https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#quoting-code

frankie567 avatar Feb 01 '24 20:02 frankie567

Yes, but it seems like GitHub only has these keybindings on the meta, i.e Cmd (macOS), key? Created a PR to "limit" it to the same here https://github.com/polarsource/polar/pull/2431

Fun fact: The ctrl-<X> keybindings are actually from Emacs which macOS supports across all text fields. Don't expect Windows to support the same though (classic) :) https://jblevins.org/log/kbd

Since GitHub leaves the standard OS shortcuts here for Ctrl, but supports these on Cmd, I think we should do the same here by simply dropping keybindings for Ctrl entirely.

birkjernstrom avatar Feb 01 '24 20:02 birkjernstrom

Well, sorry to sparkle a debate on something like this but I'm not sure it's a good idea to drop Ctrl bindings. It'll likely break every shortcuts (like italic or bold) on Windows and Linux where the Meta key is not used to trigger this kind of shortcuts.

Maybe we should do like you suggest but only if we are on macOS where the Meta key (Cmd) is a thing.

frankie567 avatar Feb 02 '24 08:02 frankie567

Not at all @frankie567 – that's a totally valid point that I should have thought of. Will update so we only use the meta on macOS and ctrl for all others.

birkjernstrom avatar Feb 03 '24 19:02 birkjernstrom