Bug report in codemirror/view main branch

I initially wanted to send my repro in a codesandbox instance, but I couldn’t figure out how to have it depend on the latest commit in github rather than a published version. This is a bug that triggers when using a stream parser.

Repro steps
1/ in an empty codemirror, type test.
2/ type a " at the end of the text
3/ move to the beginning of the text and type "
4/ move back to the very end and type anything. you’ll notice that two characters appear every time you press a key. Also, interestingly it won’t let you click and place the caret inside the word test.

Codemirror code to create the above repro

import { basicSetup } from "codemirror";
import { EditorView } from "@codemirror/view";
import { lua } from "@codemirror/legacy-modes/mode/lua";
import { StreamLanguage } from "@codemirror/language";

let view = new EditorView({
  extensions: [
    basicSetup,
    StreamLanguage.define(lua),
  ],
  parent: document.body,
});

Blame diff
A colleague of mine said that when he bisected the blame diff was Make sure the view tree is destroyed on editor destroy or reset · codemirror/view@9c062aa · GitHub (though I haven’t verified this myself.) I couldn’t repro this in codesandbox using the latest published version, so I do think it’s one of the most recent commits.

I can create a video of the bug if that would be helpful.

Thanks!

Thanks for the reproduction instructions! This patch should resolve this.

Much appreciated! Will test and let you know if I run into anything