Skip to content

feat: v0.2.0 — Ghostty + tmux deep integration (truecolor + highlight + hardware-cursor mode)#1

Merged
rz1989s merged 12 commits into
mainfrom
feat/ghostty-tmux-deep
Jul 20, 2026
Merged

feat: v0.2.0 — Ghostty + tmux deep integration (truecolor + highlight + hardware-cursor mode)#1
rz1989s merged 12 commits into
mainfrom
feat/ghostty-tmux-deep

Conversation

@rz1989s

@rz1989s rz1989s commented Jul 20, 2026

Copy link
Copy Markdown
Member

Summary

v0.2.0 deepens @getpipher/cursor for the Ghostty + tmux stack across three composing axes (spec: docs/superpowers/specs/2026-07-19-ghostty-tmux-deep-design.md; plan: docs/superpowers/plans/2026-07-19-ghostty-tmux-deep.md):

  • (A) Truecolor + theme-aware cursor colors — replace the v0.1 256-color approximation with exact colors sourced from pi's Theme.getFgAnsi("accent"/"dim"), resolved to the theme's color mode (truecolor end-to-end through tmux Tc). Optional cursorColor: "#RRGGBB" override. The cursor color follows the app theme automatically — no Ghostty-config parsing.
  • (B) Char-preserving highlight unfocused style — a 6th unfocused style: colored undercurl (4:3 + 58:2::R:G:B) in truecolor, plain colored underline in 256. Preserves the char under the cursor (solves the v0.1 char-hidden limitation for an unfocused state).
  • (C) Opt-in hardware cursor mode — drives Ghostty's native cursor for the focused state via DECSCUSR (\x1b[<n> q) + OSC 12 (\x1b]12;<color>\x07), with tui.setShowHardwareCursor(true) + pi's hardware-cursor positioning. Focused cell renders as a bare char so only the native cursor shows. Unfocused falls back to the fake-cursor transform (with A's colors + B's styles). restoreCursor() on session_shutdown resets shape/color (no terminal state leak). Native DECSCUSR blink replaces the fake BlinkController in hardware+blink.

Defaults preserve v0.1.1 behavior exactly (cursorColor: "accent", cursorMode: "fake") — no visual regression.

Config additions

  • cursorColor: "accent" | "#RRGGBB" (default "accent")
  • cursorMode: "fake" | "hardware" (default "fake")
  • UnfocusedStyle gains "highlight"

Commands

  • /cursor color accent|#RRGGBB
  • /cursor mode fake|hardware
  • /cursor unfocused highlight

Tasks (9, TDD)

T1 config schema · T2 render color/escape helpers · T3 thread Theme + truecolor · T4 cursorColor hex · T5 highlight undercurl · T6 hardware focused (DECSCUSR/OSC12) · T7 restoreCursor + unfocused/refocus · T8 panel + subcommands · T9 docs + version bump.

Verification

  • pnpm typecheck clean · pnpm test:run 122/122 pass (was 83 at v0.1.1).
  • pnpm pack --dry-run@getpither/cursor@0.2.0, includes lib/render.ts + lib/editor.ts.

⚠️ Live-verification deferred

A/B/C are unit-tested against mocks (mock Theme, mock tui capturing DECSCUSR/OSC12 writes) but not verified against a live Ghostty+tmux pane in this release — mirrors the v0.1 herdr + v0.1.1 cmux caveat. Flagged in README + AGENTS + code headers. Hardware mode is Ghostty-targeted (DECSCUSR/OSC12 are standard but only verified on Ghostty here). 256-color theme → OSC 12 skipped (no exact hex). Live-verify checklist in the spec §12.

Spike-verified mechanism (C feasibility)

  • TUI.setShowHardwareCursor(bool) is public; the extension receives the tui instance in setEditorComponent((tui, theme, kb) => …).
  • positionHardwareCursor() writes only \x1b[?25h per frame (never DECSCUSR/OSC12) → our mode settings persist across pi render frames.
  • Emit path: tui.terminal.write(seq) (confirmed — TUI.terminal is public, used ~15× inside pi-tui).

Merge → tag v0.2.0 (signed) → release.yml publishes to npm.

rz1989s added 12 commits July 19, 2026 17:44
Design spec for v0.2.0: (A) truecolor + theme-aware cursor colors via
pi's Theme.getFgAnsi + optional hex override; (B) char-preserving
'highlight' unfocused style using Ghostty styled underlines through tmux
passthrough; (C) opt-in hardware-cursor mode (DECSCUSR + OSC 12) driving
Ghostty's native cursor for the focused state, fake-cursor transform for
unfocused. Spike-verified C feasible (tui.setShowHardwareCursor public;
DECSCUSR/OSC12 persist across pi render frames). Defaults preserve v0.1.1
behavior. Self-reviewed; pending RECTOR review before writing-plans.
…sc12, resolveFocused/UnfocusedColor, themeAccentHex) (v0.2.0 T2)
… not empty OSC 12; drop unused FocusedStyle import

Code-review fix on PR #1: \x1b]12;\x07 (OSC 12 with empty payload) is undefined
behavior; the standard reset-cursor-color is OSC 112 (\x1b]112\x07). Prevents a
cosmetic terminal state leak (accent cursor color persisting after pi exits).
Also drops the unused FocusedStyle import in editor.ts.
@rz1989s
rz1989s merged commit d7ecf42 into main Jul 20, 2026
2 checks passed
@rz1989s
rz1989s deleted the feat/ghostty-tmux-deep branch July 20, 2026 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant