From 7e63d721bc214b3e5da40af0d1c5775678153bbb Mon Sep 17 00:00:00 2001 From: Yuri Karamian Date: Thu, 25 Jun 2026 16:08:25 +0200 Subject: [PATCH] Fix 'Open in New Window' cursor jumping to the top when pausing (ignore the file-watcher echo of the window's own save) --- src/lib/components/Editor.svelte | 5 +++++ src/lib/components/NoteWindow.svelte | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/lib/components/Editor.svelte b/src/lib/components/Editor.svelte index ab9a2bf..8bcc27d 100644 --- a/src/lib/components/Editor.svelte +++ b/src/lib/components/Editor.svelte @@ -2660,6 +2660,11 @@ } } + // The markdown body the editor would currently save; used to ignore the file-watcher echo of our own save. + export function getCurrentBody(): string { + return $sourceMode ? restoreTitleH1(sourceContent) : editorToMarkdown(); + } + // ── Tag editing (active note) ── function toggleTagMenu(e: MouseEvent) { if (tagMenu) { tagMenu = null; return; } diff --git a/src/lib/components/NoteWindow.svelte b/src/lib/components/NoteWindow.svelte index 0dee877..4634cee 100644 --- a/src/lib/components/NoteWindow.svelte +++ b/src/lib/components/NoteWindow.svelte @@ -103,8 +103,11 @@ if (!$editorDirty) { try { const content = await readNote(notePath); - $activeNote = content; - editor?.loadNote(notePath, content.content); + // Ignore the file-watcher echo of our own save; only reload genuine external edits. + if (content.content.trim() !== (editor?.getCurrentBody() ?? '').trim()) { + $activeNote = content; + editor?.loadNote(notePath, content.content); + } } catch (_) {} } }