pi-zentui 0.17.0 → 0.17.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.
@@ -1014,7 +1014,11 @@ export default function (pi: ExtensionAPI) {
1014
1014
  sessionLifecycle.defer(() => {
1015
1015
  if (!isTuiContext(ctx) || !effectiveEditorEnabled()) return;
1016
1016
  const observed = observeEditorFactory(ctx);
1017
- if (!observed.known || observed.factory === installedEditorFactory) return;
1017
+ if (!observed.known) return;
1018
+ if (observed.factory === installedEditorFactory) {
1019
+ reconcileProjectRefresh(ctx);
1020
+ return;
1021
+ }
1018
1022
  if (!observed.factory || !isOwnedEditorFactory(observed.factory)) {
1019
1023
  clearEditorOwnership();
1020
1024
  reconcileProjectRefresh(ctx);
@@ -1022,6 +1026,7 @@ export default function (pi: ExtensionAPI) {
1022
1026
  return;
1023
1027
  }
1024
1028
  trackZentuiEditorFactory(observed.factory);
1029
+ reconcileProjectRefresh(ctx);
1025
1030
  refresh();
1026
1031
  });
1027
1032
  };
@@ -1107,7 +1112,7 @@ export default function (pi: ExtensionAPI) {
1107
1112
  setEditorComponent(patch: Partial<EditorComponentConfig>, ctx: ExtensionContext) {
1108
1113
  currentConfig = saveEditorComponentPatch(patch);
1109
1114
  let result: EditorChangeResult | undefined;
1110
- if ((patch.enabled !== undefined || patch.style !== undefined) && isTuiContext(ctx)) {
1115
+ if (patch.enabled !== undefined && isTuiContext(ctx)) {
1111
1116
  result = reconcileEditor(ctx);
1112
1117
  }
1113
1118
  if (patch.style !== undefined && patch.style !== "minimalist") {
@@ -155,9 +155,12 @@ function renderTopRight(
155
155
  uiTheme: Theme,
156
156
  config: ZentuiConfig,
157
157
  availableWidth: number,
158
+ renderBorder: (text: string) => string,
158
159
  ): string {
159
160
  const source = config.components.editor.colorSource;
160
161
  const parts: string[] = [];
162
+ const joinParts = (values: string[]) =>
163
+ values.map((part, index) => (index > 0 ? `${renderBorder(" – ")}${part}` : part)).join("");
161
164
  const cost = config.components.editor.styles.minimalist.showCost
162
165
  ? sanitizeEditorMetadataText(metadata.costLabel ?? "")
163
166
  : "";
@@ -213,7 +216,7 @@ function renderTopRight(
213
216
  for (const gaugeWidth of [5, 3]) {
214
217
  const gauge = `[${buildContextGauge(percent, gaugeWidth, config.icons.mode === "ascii")}] ${text}`;
215
218
  const styledGauge = renderStyleForSource(uiTheme, source, style, gauge);
216
- const candidate = joinStyled([...parts, styledGauge], safeThemeFg(uiTheme, "muted", " – "));
219
+ const candidate = joinParts([...parts, styledGauge]);
217
220
  if (visibleWidth(candidate) <= availableWidth) {
218
221
  context = styledGauge;
219
222
  break;
@@ -222,7 +225,7 @@ function renderTopRight(
222
225
  }
223
226
  parts.push(context);
224
227
  }
225
- return joinStyled(parts, safeThemeFg(uiTheme, "muted", " – "));
228
+ return joinParts(parts);
226
229
  }
227
230
 
228
231
  function renderBottomLeft(
@@ -389,7 +392,7 @@ export function renderMinimalistFrame({
389
392
  width,
390
393
  left: topLeft,
391
394
  leftFallbacks: topFallbacks,
392
- right: renderTopRight(metadata, uiTheme, config, topRightBudget),
395
+ right: renderTopRight(metadata, uiTheme, config, topRightBudget, renderBorder),
393
396
  leftCorner: "╭",
394
397
  rightCorner: "╮",
395
398
  renderBorder,
@@ -887,6 +887,10 @@ export class PolishedEditor extends CustomEditor {
887
887
  render(width: number): string[] {
888
888
  this.latestFixedLayout = null;
889
889
  const config = this.getConfig();
890
+ if (!config.components.editor.enabled) {
891
+ this.reportMinimalistDecoration(false);
892
+ return clampRenderedLines(super.render(width), width);
893
+ }
890
894
  if (config.components.editor.style === "minimalist") {
891
895
  if (width <= 4) {
892
896
  this.reportMinimalistDecoration(false);
@@ -1086,6 +1090,10 @@ export class WrappedPolishedEditor implements EditorComponent {
1086
1090
  render(width: number): string[] {
1087
1091
  this.latestFixedLayout = null;
1088
1092
  const config = this.getConfig();
1093
+ if (!config.components.editor.enabled) {
1094
+ this.reportMinimalistDecoration(false);
1095
+ return clampRenderedLines(this.base.render(width), width);
1096
+ }
1089
1097
  if (config.components.editor.style === "minimalist") {
1090
1098
  if (width <= 4) {
1091
1099
  this.reportMinimalistDecoration(false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-zentui",
3
- "version": "0.17.0",
3
+ "version": "0.17.1",
4
4
  "description": "A Starship-inspired statusline and Opencode-style TUI for Pi.",
5
5
  "type": "module",
6
6
  "license": "MIT",