Add PI_NO_HARDWARE_CURSOR env var for terminals with limited escape sequence support

Fixes cursor visibility issues in JetBrains IDE terminals (IntelliJ, PyCharm) where
the hardware cursor either blinks or becomes invisible depending on settings.

Fixes #771
This commit is contained in:
Mario Zechner 2026-01-16 12:51:09 +01:00
parent 3a475fe165
commit 4dbf094b65
3 changed files with 12 additions and 0 deletions

View file

@ -981,6 +981,12 @@ export class TUI extends Container {
* @param totalLines Total number of rendered lines
*/
private positionHardwareCursor(cursorPos: { row: number; col: number } | null, totalLines: number): void {
// PI_NO_HARDWARE_CURSOR=1 disables hardware cursor for terminals that don't handle it well
if (process.env.PI_NO_HARDWARE_CURSOR === "1") {
this.terminal.hideCursor();
return;
}
if (!cursorPos || totalLines <= 0) {
this.terminal.hideCursor();
return;