mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 09:01:14 +00:00
fix(tui): move lastAction handling out of setTextInternal()
The caller is responsible for doing that.
This commit is contained in:
parent
609095b0b6
commit
beb1455cab
1 changed files with 1 additions and 4 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue