@oh-my-pi/pi-tui 14.6.1 → 14.6.2

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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/src/terminal.ts +12 -8
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@oh-my-pi/pi-tui",
4
- "version": "14.6.1",
4
+ "version": "14.6.2",
5
5
  "description": "Terminal User Interface library with differential rendering for efficient text-based applications",
6
6
  "homepage": "https://github.com/can1357/oh-my-pi",
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": "14.6.1",
41
- "@oh-my-pi/pi-utils": "14.6.1",
40
+ "@oh-my-pi/pi-natives": "14.6.2",
41
+ "@oh-my-pi/pi-utils": "14.6.2",
42
42
  "lru-cache": "11.3.5",
43
43
  "marked": "^18.0.2"
44
44
  },
package/src/terminal.ts CHANGED
@@ -96,6 +96,10 @@ export interface Terminal {
96
96
  get appearance(): TerminalAppearance | undefined;
97
97
  }
98
98
 
99
+ function isWindowsSubsystemForLinux(): boolean {
100
+ return process.platform === "linux" && (!!$env.WSL_DISTRO_NAME || !!$env.WSL_INTEROP);
101
+ }
102
+
99
103
  /**
100
104
  * Real terminal using process.stdin/stdout
101
105
  */
@@ -105,7 +109,7 @@ export class ProcessTerminal implements Terminal {
105
109
  #resizeHandler?: () => void;
106
110
  #kittyProtocolActive = false;
107
111
  #modifyOtherKeysActive = false;
108
- #modifyOtherKeysTimeout?: ReturnType<typeof setTimeout>;
112
+ #modifyOtherKeysTimeout?: Timer;
109
113
  #stdinBuffer?: StdinBuffer;
110
114
  #stdinDataHandler?: (data: string) => void;
111
115
  #dead = false;
@@ -118,7 +122,6 @@ export class ProcessTerminal implements Terminal {
118
122
  #osc11ResponseBuffer = "";
119
123
  #pendingDa1Sentinels = 0;
120
124
  #osc11PollTimer?: Timer;
121
- #mode2031Active = false;
122
125
  #mode2031DebounceTimer?: Timer;
123
126
 
124
127
  get kittyProtocolActive(): boolean {
@@ -185,7 +188,12 @@ export class ProcessTerminal implements Terminal {
185
188
 
186
189
  // Start periodic OSC 11 re-query for terminals without Mode 2031
187
190
  // (Warp, Alacritty, WezTerm, iTerm2). Self-disables once Mode 2031 fires.
188
- this.#startOsc11Poll();
191
+ // Windows Terminal under WSL has been observed to close the hosting tab
192
+ // after repeated OSC 11/DA1 probes. Keep the initial/event-driven probes,
193
+ // but avoid background polling there.
194
+ if (!isWindowsSubsystemForLinux()) {
195
+ this.#startOsc11Poll();
196
+ }
189
197
  }
190
198
 
191
199
  /**
@@ -328,10 +336,7 @@ export class ProcessTerminal implements Terminal {
328
336
  // (Neovim convention — coalesces rapid notifications during transitions)
329
337
  const appearanceMatch = sequence.match(appearanceDsrPattern);
330
338
  if (appearanceMatch) {
331
- if (!this.#mode2031Active) {
332
- this.#mode2031Active = true;
333
- this.#stopOsc11Poll();
334
- }
339
+ this.#stopOsc11Poll();
335
340
  if (this.#mode2031DebounceTimer) clearTimeout(this.#mode2031DebounceTimer);
336
341
  this.#mode2031DebounceTimer = setTimeout(() => {
337
342
  this.#mode2031DebounceTimer = undefined;
@@ -515,7 +520,6 @@ export class ProcessTerminal implements Terminal {
515
520
  this.#osc11QueryQueued = false;
516
521
  this.#osc11ResponseBuffer = "";
517
522
  this.#pendingDa1Sentinels = 0;
518
- this.#mode2031Active = false;
519
523
 
520
524
  // Disable Kitty keyboard protocol if not already done by drainInput()
521
525
  if (this.#kittyProtocolActive) {