From 2be5325eaf6911a2aac8623804296e3e5c727264 Mon Sep 17 00:00:00 2001 From: Grol Grol Date: Sat, 5 Jul 2025 15:28:47 +0300 Subject: [PATCH] =?UTF-8?q?=D1=84=D0=B8=D0=BA=D1=81=20=D0=B1=D0=B0=D0=B3?= =?UTF-8?q?=D0=B0=20=D1=81=20=D0=B2=D1=81=D1=82=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=BD=D1=8B=D0=BC=20=D1=84=D0=B0=D0=B9=D0=BB=D0=BE=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SyncController.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/SyncController.ts b/src/SyncController.ts index 0e3708a..31f54a4 100644 --- a/src/SyncController.ts +++ b/src/SyncController.ts @@ -22,7 +22,7 @@ export default class SyncController { const currentText = editor.getValue(); const resultingText = this.textSyncPipeline.applySyncLogic(currentText, info.file!.path); if (resultingText !== currentText) { - this.editEditor(editor, currentText, resultingText); + await this.editEditor(editor, info as MarkdownView, currentText, resultingText); } }); } @@ -32,13 +32,13 @@ export default class SyncController { return; } await this.mutex.runExclusive(async () => { - this.vault.process(file, (currentText) => { + await this.vault.process(file, (currentText) => { return this.textSyncPipeline.applySyncLogic(currentText, file.path); }); }); } - private editEditor(editor: Editor, oldText: string, newText: string) { + private async editEditor(editor: Editor, info: MarkdownView, oldText: string, newText: string) { const cursor = editor.getCursor(); const newLines = newText.split("\n"); @@ -68,6 +68,7 @@ export default class SyncController { to: { line: lastDifferentLineIndex, ch: 0 } }); } + await info.save(); } private findDifferentLineIndexes(lines1: string[], lines2: string[]): number[] {