@pi-unipi/footer 2.17.0 → 2.17.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.
- package/package.json +1 -1
- package/src/index.ts +14 -7
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -153,13 +153,10 @@ export default function footerExtension(pi: ExtensionAPI): void {
|
|
|
153
153
|
// Glance-style input surface (pi-glance-inspired). Preserves all default
|
|
154
154
|
// editor behavior via CustomEditor subclassing; only paint differs.
|
|
155
155
|
//
|
|
156
|
-
// FOCUS-SAFETY DEFERRAL:
|
|
157
|
-
//
|
|
158
|
-
//
|
|
159
|
-
//
|
|
160
|
-
// and strand the dashboard unclosable (q/Esc would type into the editor).
|
|
161
|
-
// The boot overlay auto-closes after ~2s; we install after a grace period
|
|
162
|
-
// longer than any sane bootTimeoutMs.
|
|
156
|
+
// FOCUS-SAFETY DEFERRAL: the timer remains a grace period for the boot
|
|
157
|
+
// dashboard, but installGlanceEditor also restores any overlay focus after
|
|
158
|
+
// setEditorComponent() calls ui.setFocus(newEditor). This covers the
|
|
159
|
+
// updater prompt too, so q/Esc cannot be stranded in the editor.
|
|
163
160
|
state.glanceInstallTimer = setTimeout(() => installGlanceEditor(state, ctx), 3500);
|
|
164
161
|
|
|
165
162
|
// Sync TPS cursor with persisted assistant messages so streaming-hook
|
|
@@ -420,6 +417,15 @@ function installGlanceEditor(
|
|
|
420
417
|
): void {
|
|
421
418
|
if (st.glanceInstalled || !st.piContext || !st.glanceMode) return;
|
|
422
419
|
try {
|
|
420
|
+
const tui = st.tuiRef as (import("@earendil-works/pi-tui").TUI & {
|
|
421
|
+
isOverlayFocused?: () => boolean;
|
|
422
|
+
getFocusedComponent?: () => import("@earendil-works/pi-tui").Component | null;
|
|
423
|
+
}) | null | undefined;
|
|
424
|
+
const overlayFocused = tui !== undefined && tui !== null
|
|
425
|
+
&& (typeof tui.isOverlayFocused === "function" ? tui.isOverlayFocused() : tui.hasOverlay());
|
|
426
|
+
const overlayOwner = overlayFocused && typeof tui?.getFocusedComponent === "function"
|
|
427
|
+
? tui.getFocusedComponent() ?? null
|
|
428
|
+
: null;
|
|
423
429
|
const piCtx = st.piContext as Record<string, unknown> | undefined;
|
|
424
430
|
const cwd = (piCtx?.sessionManager as any)?.getCwd?.() ?? (piCtx as any)?.cwd ?? process.cwd();
|
|
425
431
|
const workspace = String(cwd).split("/").filter(Boolean).pop() ?? "~";
|
|
@@ -445,6 +451,7 @@ function installGlanceEditor(
|
|
|
445
451
|
};
|
|
446
452
|
}),
|
|
447
453
|
);
|
|
454
|
+
if (overlayOwner && tui) tui.setFocus(overlayOwner);
|
|
448
455
|
st.glanceInstalled = true;
|
|
449
456
|
} catch {
|
|
450
457
|
st.glanceInstalled = false;
|