@oh-my-pi/pi-tui 16.3.9 → 16.3.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [16.3.10] - 2026-07-06
6
+
7
+ ### Fixed
8
+
9
+ - Registered emergency terminal restore with the postmortem fatal path whenever a real terminal starts, so fatal exits restore raw mode/alternate screen on the normal CLI graph (previously the registration was a side effect of a barrel module the CLI never imported).
10
+
5
11
  ## [16.3.9] - 2026-07-06
6
12
 
7
13
  ### Fixed
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@oh-my-pi/pi-tui",
4
- "version": "16.3.9",
4
+ "version": "16.3.11",
5
5
  "description": "Terminal User Interface library with differential rendering for efficient text-based applications",
6
6
  "homepage": "https://omp.sh",
7
7
  "author": "Can Boluk",
@@ -37,8 +37,8 @@
37
37
  "fmt": "biome format --write ."
38
38
  },
39
39
  "dependencies": {
40
- "@oh-my-pi/pi-natives": "16.3.9",
41
- "@oh-my-pi/pi-utils": "16.3.9",
40
+ "@oh-my-pi/pi-natives": "16.3.11",
41
+ "@oh-my-pi/pi-utils": "16.3.11",
42
42
  "lru-cache": "11.5.1",
43
43
  "marked": "^18.0.5"
44
44
  },
package/src/terminal.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { dlopen, FFIType, ptr } from "bun:ffi";
2
2
  import * as fs from "node:fs";
3
- import { $env, isBunTestRuntime, isTerminalHeadless, logger } from "@oh-my-pi/pi-utils";
3
+ import { $env, isBunTestRuntime, isTerminalHeadless, logger, postmortem } from "@oh-my-pi/pi-utils";
4
4
  import { setKittyProtocolActive } from "./keys";
5
5
  import { StdinBuffer } from "./stdin-buffer";
6
6
  import {
@@ -161,6 +161,15 @@ let terminalEverStarted = false;
161
161
  // jumps to the viewport home, dropping the parent shell prompt on top of the
162
162
  // dead frame after exit.
163
163
  let altScreenActive = false;
164
+ let terminalRestoreRegistered = false;
165
+
166
+ function registerPostmortemTerminalRestore(): void {
167
+ if (terminalRestoreRegistered) return;
168
+ terminalRestoreRegistered = true;
169
+ postmortem.register("terminal-restore", () => {
170
+ emergencyTerminalRestore();
171
+ });
172
+ }
164
173
 
165
174
  /** Record alternate-screen state (called by the TUI on `?1049h`/`?1049l` writes). */
166
175
  export function setAltScreenActive(active: boolean): void {
@@ -523,6 +532,7 @@ export class ProcessTerminal implements Terminal {
523
532
  // escapes never reach the developer's terminal during `bun test`.
524
533
  this.#headless = isTerminalHeadless();
525
534
  if (this.#headless) return;
535
+ registerPostmortemTerminalRestore();
526
536
 
527
537
  // Register for emergency cleanup
528
538
  activeTerminal = this;