Ctrl-Space seemingly not working

Hi, thanks for a great library! I stumbled into something that looks like a bug.

I declared custom “Ctrl-Space” key binding and codemirror never runs it. I also noticed codemirror/autocomplete has startCompletion command, it also does not work.

I did some debugging and I found that binding is empty when Ctrl-Space shortcut is empty. Also, Ctrl-Space is stored as Ctrl- , and user input is interpreted as Ctrl-Control for some reason.


Could you please verify this is a bug?

Bug was detected in MacOS Chrome/Firefox.

Can you show the extensions you’re adding to your editor?

Unfortunately my editor uses lots of extensions, both predefined and custom. So I cannot show them all in a comprehensible way.

But it can be reproduced in the codemirror sandbox:

import {basicSetup, EditorView} from "codemirror"
import {keymap} from "@codemirror/view"

function moveToLine(view) {
  let line = prompt("Which line?")
  if (!/^\d+$/.test(line) || +line <= 0 || +line > view.state.doc.lines)
    return false
  let pos = view.state.doc.line(+line).from
  view.dispatch({selection: {anchor: pos}, userEvent: "select"})
  return true

new EditorView({
  doc: "a\nb\nc\n",
  extensions: [
    keymap.of([{key: "Alt-l", run: moveToLine}, {key: "Ctrl-Space", run: moveToLine}]),
  parent: document.body

Did you have a chance to look at this one?

Or please let me know if I am on my own with this one for the nearest future.

The basic setup binds ctrl-space to startCompletion with high precedence, so that is capturing that key. You’ll have to either do your own configuration to change that, or make sure your keymap has higher precedence.