From 81464015acb845cf4d59ea112c6766af42f89dfc Mon Sep 17 00:00:00 2001 From: Fred Sauer Date: Wed, 18 Feb 2026 17:35:39 -0800 Subject: [PATCH] insertText() CM5 -> CM6 --- src/ide/views/editors.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ide/views/editors.ts b/src/ide/views/editors.ts index eea0501f..d5b5615c 100644 --- a/src/ide/views/editors.ts +++ b/src/ide/views/editors.ts @@ -299,8 +299,12 @@ export class SourceEditor implements ProjectView { } insertText(text: string) { - var cur = this.editor.getCursor(); - this.editor.replaceRange(text, cur, cur); + const main = this.editor.state.selection.main; + this.editor.dispatch({ + changes: { from: main.from, to: main.to, insert: text }, + selection: { anchor: main.from + text.length }, + userEvent: "input.paste" + }); } highlightLines(start: number, end: number) {