codemirror / dev

Development repository for the CodeMirror editor project
https://codemirror.net/
Other
5.94k stars 376 forks source link

Autocomplete uses Ctrl-Space to start, which conflicts with IME on Mac, use Mod-Space instead. #1439

Closed stephanemagnenat closed 2 months ago

stephanemagnenat commented 2 months ago

Describe the issue

In this line we see that the autocomplete uses Ctrl-Space to start completion. However, on Mac OS, according to this post's answer, it is bound to change the IME. It thus seems logical to me that the default autocomplete start shortcut should be Mod-Space on Mac.

In the keybinding documentation, it is stated that the Mod- modifier is a shorthand for Cmd- on Mac and Ctrl- on other platforms. Therefore I suggest to change the autocomplete code from Ctrl-Space to Mod-Space.

Browser and platform

MacOS

Reproduction link

No response

marijnh commented 2 months ago

The current binding is this way because Cmd-Space is already used to bring up Spotlight (see this issue, and actually it's also mentioned in the stackoverflow thread you linked). We're currently aligned with VS Code in using Ctrl-Space, which seems to be a common convention across tools. It appears VS Code also provides Alt-` as a backup. Would adding that to our default keybindings for macOS help for you?

stephanemagnenat commented 2 months ago

Thank you for the fast answer, sorry I missed the point regarding Cmd-Space.

It probably makes sense to have the same key binding as VS Code indeed.

marijnh commented 2 months ago

Attached patch adds this binding.