nrfm
1
This can be reproduced in the online demos.
- Go to the editor at https://codemirror.net/6/
- place cursor directly after a character.
- press SPACE a couple of times. When pressing slow, all is fine, when pressing fast, the dot is inserted.
It seems to be language independent as the same happens in https://nextjournal.github.io/clojure-mode/
I am on a Mac M1 . Safari + Chrome both exhibit the same behaviour.
Thanks
nrfm
2
I am trying a few things to see if i can pinpoint where the issue is.
- editor + state + no extensions . Still happening.
- editor + state + no extensions + empty content. Still happening.
- editor with no config. Also still happening.
marijn
3
Does your browser behave differently in a regular contenteditable element?
nrfm
4
Actually it does, so this must be due to my mac settings.
However, my older editor running codemirror 5.47.0 doesn’t add the dot. I guess codemirror 5 is not based on contentEditable.
Just upgraded my mac and didnt know about this feature…
Apologies for the noise 
Hi there, just had the same issue, here is a link to an article showing how to disable this behavior on macOS : How to Stop Typing Periods Automatically with Double-Space on MacOS
The patch below detects this behavior and replaces it with a regular space insertion.
acnebs
7
Is it possible to reverse this in some way without forking @codemirror/view
? We actually want this behavior in certain contexts. Thanks!
marijn
8
Are you also enabling autocorrect? One approach would be to only suppress this when autocorrect is turned off.
acnebs
9
Yes we are. Turning it off if autocorrect is turned off would actually be an ideal solution for us (I think).
I am on "@codemirror/view": "6.36.1"
, and it seems that pressing double space still seems to insert the dot.
Do I only need to add EditorView.contentAttributes.of({ autocorrect: 'off' }),
to my extensions? It doesn’t seem to prevent it in my environment.
I have also tried EditorView.editorAttributes.of({ autocorrect: 'off' }),
, but that doesn’t seem to work for me either.
marijn
14
Indeed, this seems to have regressed. This patch should repair it.
1 Like