@narumitw/pi-btw 0.56.0 → 0.56.1
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/dist/index.ts +19 -5
- package/dist/index.ts.map +2 -2
- package/package.json +1 -1
- package/src/fullscreen-ui.ts +24 -5
package/package.json
CHANGED
package/src/fullscreen-ui.ts
CHANGED
|
@@ -300,9 +300,10 @@ class BtwFullscreenHost<T> implements Component {
|
|
|
300
300
|
private disposed = false;
|
|
301
301
|
private finished = false;
|
|
302
302
|
private parentStopped = false;
|
|
303
|
-
private
|
|
303
|
+
private parentRestoreAttempted = false;
|
|
304
304
|
private fullscreenCreated = false;
|
|
305
305
|
private fullscreenStopped = false;
|
|
306
|
+
private parentRestoreQueued = false;
|
|
306
307
|
private cleanupError: unknown;
|
|
307
308
|
|
|
308
309
|
constructor(
|
|
@@ -356,7 +357,11 @@ class BtwFullscreenHost<T> implements Component {
|
|
|
356
357
|
try {
|
|
357
358
|
this.hardCancelActiveCustom?.();
|
|
358
359
|
} finally {
|
|
359
|
-
|
|
360
|
+
// ProcessTerminal.stop() destroys its active input buffer. Defer only the
|
|
361
|
+
// physical handoff so Windows can finish dispatching this Ctrl+C first.
|
|
362
|
+
// Pi has no public input injection, so do not replay bytes already coalesced
|
|
363
|
+
// behind the hard-cancel key.
|
|
364
|
+
this.queueParentRestore();
|
|
360
365
|
}
|
|
361
366
|
return { consume: true };
|
|
362
367
|
});
|
|
@@ -376,9 +381,23 @@ class BtwFullscreenHost<T> implements Component {
|
|
|
376
381
|
this.done(outcome);
|
|
377
382
|
}
|
|
378
383
|
|
|
384
|
+
private queueParentRestore(): void {
|
|
385
|
+
if (this.parentRestoreQueued || this.parentRestoreAttempted) return;
|
|
386
|
+
this.parentRestoreQueued = true;
|
|
387
|
+
queueMicrotask(() => {
|
|
388
|
+
this.parentRestoreQueued = false;
|
|
389
|
+
this.restoreParent();
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
|
|
379
393
|
private restoreParent(): void {
|
|
380
|
-
this.removeHardCancelListener
|
|
394
|
+
const removeHardCancelListener = this.removeHardCancelListener;
|
|
381
395
|
this.removeHardCancelListener = undefined;
|
|
396
|
+
try {
|
|
397
|
+
removeHardCancelListener?.();
|
|
398
|
+
} catch (error) {
|
|
399
|
+
this.cleanupError ??= error;
|
|
400
|
+
}
|
|
382
401
|
if (this.fullscreenCreated && !this.fullscreenStopped) {
|
|
383
402
|
this.fullscreenStopped = true;
|
|
384
403
|
try {
|
|
@@ -387,7 +406,7 @@ class BtwFullscreenHost<T> implements Component {
|
|
|
387
406
|
this.cleanupError ??= error;
|
|
388
407
|
}
|
|
389
408
|
}
|
|
390
|
-
if (!this.parentStopped || this.
|
|
409
|
+
if (!this.parentStopped || this.parentRestoreAttempted) return;
|
|
391
410
|
const parentOverlay = this.parentOverlay;
|
|
392
411
|
this.parentOverlay = undefined;
|
|
393
412
|
try {
|
|
@@ -396,8 +415,8 @@ class BtwFullscreenHost<T> implements Component {
|
|
|
396
415
|
this.cleanupError ??= error;
|
|
397
416
|
}
|
|
398
417
|
try {
|
|
418
|
+
this.parentRestoreAttempted = true;
|
|
399
419
|
this.parent.start();
|
|
400
|
-
this.parentRestarted = true;
|
|
401
420
|
this.parent.renderNow(false);
|
|
402
421
|
} catch (error) {
|
|
403
422
|
this.cleanupError ??= error;
|