From d85041bf4aca90016f71d905e96ee70ad7a8bf0f Mon Sep 17 00:00:00 2001 From: frelodev Date: Sun, 27 Oct 2024 11:48:16 +0100 Subject: [PATCH] fix: yet another fix, now it should correctly delete lock --- src/commands/buffers.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/commands/buffers.ts b/src/commands/buffers.ts index b311e89..b7080e0 100644 --- a/src/commands/buffers.ts +++ b/src/commands/buffers.ts @@ -31,16 +31,13 @@ export async function apply_changes_to_buffer(path: string, controller: codemp.B ) locks.set(path, event.change.content); - if (!await editor.edit(editBuilder => { + let success = await editor.edit(editBuilder => { editBuilder .replace(range, event.change.content) - })) { - continue; - } - else { - controller.ack(event.version); - } + }); + if(success) controller.ack(event.version); locks.delete(path); + if(!success) continue; if (event.hash !== undefined) { if (codemp.hash(editor.document.getText()) !== event.hash) {