We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2f8b59d commit 59ff625Copy full SHA for 59ff625
packages/editor/src/lib/Workspace.svelte.ts
@@ -556,7 +556,10 @@ export class Workspace {
556
const existing = state.doc.toString();
557
558
if (file.contents !== existing) {
559
- const current_cursor_position = this.#view?.state.selection.ranges[0].from!;
+ const current_cursor_position = Math.min(
560
+ this.#view?.state.selection.ranges[0].from!,
561
+ file.contents.length
562
+ );
563
564
const transaction = state.update({
565
changes: {
0 commit comments