import type { EditorView } from '@codemirror/view' export function applyCursorChange(view: EditorView, cursorPos: number): void { requestAnimationFrame(() => { view.dispatch({ selection: { anchor: Math.min(cursorPos, view.state.doc.length) } }) view.focus() }) }