mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-21 05:02:14 +00:00
fix(tui): fix scrollback overwrite when appending lines past viewport
Appended lines were not committed to terminal scrollback because the renderer used cursor movement (CSI B) and carriage return without linefeed. This caused earlier content to be overwritten when the viewport filled up. Changes: - For appended lines, emit \r\n to create real scrollback lines - When target row is below viewport, scroll with \r\n before positioning - Add PI_TUI_WRITE_LOG env var for debugging raw ANSI output - Add fullRedraws readonly property to TUI class - Add viewport-overwrite-repro.ts test script fixes #954
This commit is contained in:
parent
fa8b26a184
commit
a6f9c3cf0d
6 changed files with 165 additions and 6 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import * as fs from "node:fs";
|
||||
import { setKittyProtocolActive } from "./keys.js";
|
||||
import { StdinBuffer } from "./stdin-buffer.js";
|
||||
|
||||
|
|
@ -47,6 +48,7 @@ export class ProcessTerminal implements Terminal {
|
|||
private _kittyProtocolActive = false;
|
||||
private stdinBuffer?: StdinBuffer;
|
||||
private stdinDataHandler?: (data: string) => void;
|
||||
private writeLogPath = process.env.PI_TUI_WRITE_LOG || "";
|
||||
|
||||
get kittyProtocolActive(): boolean {
|
||||
return this._kittyProtocolActive;
|
||||
|
|
@ -184,6 +186,13 @@ export class ProcessTerminal implements Terminal {
|
|||
|
||||
write(data: string): void {
|
||||
process.stdout.write(data);
|
||||
if (this.writeLogPath) {
|
||||
try {
|
||||
fs.appendFileSync(this.writeLogPath, data, { encoding: "utf8" });
|
||||
} catch {
|
||||
// Ignore logging errors
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
get columns(): number {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue