From beb1455cab4102c757e7dbc04a729f9e05292254 Mon Sep 17 00:00:00 2001 From: Sviatoslav Abakumov Date: Sun, 25 Jan 2026 16:34:27 +0400 Subject: [PATCH] fix(tui): move lastAction handling out of setTextInternal() The caller is responsible for doing that. --- packages/tui/src/components/editor.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/tui/src/components/editor.ts b/packages/tui/src/components/editor.ts index 96d43e12..32829367 100644 --- a/packages/tui/src/components/editor.ts +++ b/packages/tui/src/components/editor.ts @@ -282,9 +282,6 @@ export class Editor implements Component, Focusable { /** Internal setText that doesn't reset history state - used by navigateHistory */ private setTextInternal(text: string): void { - // Reset kill ring state - external text changes break accumulation/yank chains - this.lastAction = null; - const lines = text.replace(/\r\n/g, "\n").replace(/\r/g, "\n").split("\n"); this.state.lines = lines.length === 0 ? [""] : lines; this.state.cursorLine = this.state.lines.length - 1; @@ -805,13 +802,13 @@ export class Editor implements Component, Focusable { } setText(text: string): void { + this.lastAction = null; this.historyIndex = -1; // Exit history browsing mode // Push undo snapshot if content differs (makes programmatic changes undoable) if (this.getText() !== text) { this.pushUndoSnapshot(); } this.setTextInternal(text); - this.lastAction = null; } /**