mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 12:03:23 +00:00
fix(tui): ensure cursor moves to end of content on exit to prevent visual artifacts
This commit is contained in:
parent
9ddbafb03a
commit
b57eafaadb
2 changed files with 16 additions and 0 deletions
|
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Cursor now moves to end of content on exit, preventing status line from being overwritten ([#629](https://github.com/badlogic/pi-mono/pull/629) by [@tallshort](https://github.com/tallshort))
|
||||||
|
|
||||||
## [0.42.5] - 2026-01-11
|
## [0.42.5] - 2026-01-11
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
|
||||||
|
|
@ -157,6 +157,18 @@ export class TUI extends Container {
|
||||||
}
|
}
|
||||||
|
|
||||||
stop(): void {
|
stop(): void {
|
||||||
|
// Move cursor to the end of the content to prevent overwriting/artifacts on exit
|
||||||
|
if (this.previousLines.length > 0) {
|
||||||
|
const targetRow = this.previousLines.length; // Line after the last content
|
||||||
|
const lineDiff = targetRow - this.cursorRow;
|
||||||
|
if (lineDiff > 0) {
|
||||||
|
this.terminal.write(`\x1b[${lineDiff}B`);
|
||||||
|
} else if (lineDiff < 0) {
|
||||||
|
this.terminal.write(`\x1b[${-lineDiff}A`);
|
||||||
|
}
|
||||||
|
this.terminal.write("\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
this.terminal.showCursor();
|
this.terminal.showCursor();
|
||||||
this.terminal.stop();
|
this.terminal.stop();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue