From 524d7f0a2fb33ee225ed4e319ed7206a24a6c1e3 Mon Sep 17 00:00:00 2001 From: ori Date: Wed, 17 Jun 2026 11:32:13 +0300 Subject: [PATCH] fix: update stale comment on undo snapshot clearing --- src/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 2f3482b..3171c51 100644 --- a/src/index.ts +++ b/src/index.ts @@ -80,8 +80,9 @@ const plugin: TuiPluginModule = { function applyActions(actions: Action[]) { let keepUndoSnapshotForBatch = false; for (const action of actions) { - // Any buffer-modifying action (other than our own deleteRange/undo) - // invalidates the undo snapshot. + // Buffer-modifying actions (cmd, insertText) clear the undo stack, + // unless this batch includes a saveUndoSnapshot (which sets + // keepUndoSnapshotForBatch to preserve the stack). if ((action.type === "cmd" || action.type === "insertText") && !keepUndoSnapshotForBatch) { undoSnapshots = []; }