fix(tui): remove backslash input buffering (#1037)

Instead of buffering `\` and waiting for the next key, let it be
inserted immediately. On Enter, check if preceded by `\` and treat as
newline.

Removed backslash handling from the Input component entirely.
This commit is contained in:
Sviatoslav Abakumov 2026-01-29 05:47:15 +04:00 committed by GitHub
parent bac57f81be
commit d57a26c88b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 61 additions and 43 deletions

View file

@ -19,7 +19,6 @@ export class Input implements Component, Focusable {
// Bracketed paste mode buffering
private pasteBuffer: string = "";
private isInPaste: boolean = false;
private pendingShiftEnter: boolean = false;
getValue(): string {
return this.value;
@ -68,22 +67,6 @@ export class Input implements Component, Focusable {
return;
}
if (this.pendingShiftEnter) {
if (data === "\r") {
this.pendingShiftEnter = false;
if (this.onSubmit) this.onSubmit(this.value);
return;
}
this.pendingShiftEnter = false;
this.value = `${this.value.slice(0, this.cursor)}\\${this.value.slice(this.cursor)}`;
this.cursor += 1;
}
if (data === "\\") {
this.pendingShiftEnter = true;
return;
}
const kb = getEditorKeybindings();
// Escape/Cancel