From d862c434245137e42446faf4c49215c4e9d7276d Mon Sep 17 00:00:00 2001 From: Tom Boucher Date: Mon, 16 Mar 2026 15:11:58 -0400 Subject: [PATCH] fix: auto-enable hardware cursor in Warp terminal (#658) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Warp terminal does not correctly re-render inverse video (\x1b[7m) cursor indicators on arrow key movement, making the cursor appear invisible when navigating with arrow keys. Auto-detect Warp via TERM_PROGRAM=WarpTerminal and enable the hardware cursor by default (same as PI_HARDWARE_CURSOR=1). The hardware cursor is positioned correctly via CURSOR_MARKER and provides reliable visual feedback in Warp. Terminals that render inverse video correctly (iTerm2, Terminal.app) are unaffected — they continue using the fake cursor by default. --- packages/pi-tui/src/tui.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pi-tui/src/tui.ts b/packages/pi-tui/src/tui.ts index c3e39acc5..4a0094298 100644 --- a/packages/pi-tui/src/tui.ts +++ b/packages/pi-tui/src/tui.ts @@ -221,7 +221,7 @@ export class TUI extends Container { private hardwareCursorRow = 0; // Actual terminal cursor row (may differ due to IME positioning) private inputBuffer = ""; // Buffer for parsing terminal responses private cellSizeQueryPending = false; - private showHardwareCursor = process.env.PI_HARDWARE_CURSOR === "1"; + private showHardwareCursor = process.env.PI_HARDWARE_CURSOR === "1" || process.env.TERM_PROGRAM === "WarpTerminal"; private clearOnShrink = process.env.PI_CLEAR_ON_SHRINK === "1"; // Clear empty rows when content shrinks (default: off) private maxLinesRendered = 0; // Track terminal's working area (max lines ever rendered) private previousViewportTop = 0; // Track previous viewport top for resize-aware cursor moves