pi-open-tui 0.2.11 → 0.2.12

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.
@@ -54,6 +54,7 @@ export default function (pi: ExtensionAPI) {
54
54
  let cleanupHeader: (() => void) | undefined;
55
55
  let cleanupFooter: (() => void) | undefined;
56
56
  let cleanupEditor: (() => void) | undefined;
57
+ let pendingUiChange: "install" | "uninstall" | undefined;
57
58
 
58
59
  const getThinkingLevel = () => (sessionLifecycle.isCurrent() ? pi.getThinkingLevel() : "off");
59
60
 
@@ -268,11 +269,10 @@ export default function (pi: ExtensionAPI) {
268
269
  saveConfig(newConfig);
269
270
  config = newConfig;
270
271
  if (lastCtx && wasEnabled !== newConfig.enabled) {
271
- if (newConfig.enabled) {
272
- applyUi(lastCtx);
273
- } else {
274
- uninstallUi(lastCtx);
275
- }
272
+ // Both directions defer to onOverlayClosed: while the settings overlay
273
+ // is open, pi core's setEditorComponent() steals focus from the overlay
274
+ // and strands it without keyboard input.
275
+ pendingUiChange = newConfig.enabled ? "install" : "uninstall";
276
276
  }
277
277
  const gitNeeded = newConfig.footerSegments.gitBranch || newConfig.footerSegments.gitStatus || newConfig.footerSegments.gitCommit;
278
278
  if (lastCtx && gitNeeded) {
@@ -282,5 +282,15 @@ export default function (pi: ExtensionAPI) {
282
282
  }
283
283
  requestFooterRender?.();
284
284
  },
285
+ onOverlayClosed: () => {
286
+ if (!lastCtx || pendingUiChange === undefined) return;
287
+ const change = pendingUiChange;
288
+ pendingUiChange = undefined;
289
+ if (change === "uninstall") {
290
+ uninstallUi(lastCtx);
291
+ } else {
292
+ applyUi(lastCtx);
293
+ }
294
+ },
285
295
  });
286
296
  }
@@ -334,6 +334,7 @@ export function registerSettingsCommand(
334
334
  hooks: {
335
335
  getConfig: () => OpenTuiConfig;
336
336
  onConfigChanged: (config: OpenTuiConfig) => void;
337
+ onOverlayClosed?: () => void;
337
338
  },
338
339
  ): void {
339
340
  pi.registerCommand("open-tui", {
@@ -356,6 +357,10 @@ export function registerSettingsCommand(
356
357
  },
357
358
  };
358
359
  }, { overlay: true });
360
+ // Overlay is closed and focus is back on the editor. Deferred UI changes
361
+ // (e.g. toggling the extension) run here, so pi core's focus restore
362
+ // cannot strand the overlay without keyboard input.
363
+ hooks.onOverlayClosed?.();
359
364
  },
360
365
  });
361
366
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-open-tui",
3
- "version": "0.2.11",
3
+ "version": "0.2.12",
4
4
  "description": "A polished TUI for Pi coding agent: animated logo header, Starship-style footer, rounded editor with model metadata, and prompt-box user messages. Combines the best of pi-haiku, pi-claude-code-tui, and pi-zentui.",
5
5
  "type": "module",
6
6
  "repository": {