mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-20 22:02:38 +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 */
|
/** Internal setText that doesn't reset history state - used by navigateHistory */
|
||||||
private setTextInternal(text: string): void {
|
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");
|
const lines = text.replace(/\r\n/g, "\n").replace(/\r/g, "\n").split("\n");
|
||||||
this.state.lines = lines.length === 0 ? [""] : lines;
|
this.state.lines = lines.length === 0 ? [""] : lines;
|
||||||
this.state.cursorLine = this.state.lines.length - 1;
|
this.state.cursorLine = this.state.lines.length - 1;
|
||||||
|
|
@ -805,13 +802,13 @@ export class Editor implements Component, Focusable {
|
||||||
}
|
}
|
||||||
|
|
||||||
setText(text: string): void {
|
setText(text: string): void {
|
||||||
|
this.lastAction = null;
|
||||||
this.historyIndex = -1; // Exit history browsing mode
|
this.historyIndex = -1; // Exit history browsing mode
|
||||||
// Push undo snapshot if content differs (makes programmatic changes undoable)
|
// Push undo snapshot if content differs (makes programmatic changes undoable)
|
||||||
if (this.getText() !== text) {
|
if (this.getText() !== text) {
|
||||||
this.pushUndoSnapshot();
|
this.pushUndoSnapshot();
|
||||||
}
|
}
|
||||||
this.setTextInternal(text);
|
this.setTextInternal(text);
|
||||||
this.lastAction = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue