@xynogen/pix-pretty 1.37.0 → 1.37.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xynogen/pix-pretty",
3
- "version": "1.37.0",
3
+ "version": "1.37.1",
4
4
  "description": "Enhanced tool output rendering with syntax highlighting, file icons, tree views, diff rendering, and FFF search",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -14,25 +14,29 @@ export function commandPreview(
14
14
  expanded = false,
15
15
  /** Body column: under the tool name (2-col status glyph + space). */
16
16
  indent = 3,
17
- /** Renderer context: the cut-off row shows the user's expand key. */
18
- ctx?: ExpandHintCtx,
17
+ /** Renderer context: expand key and whether streamed arguments are ready to highlight. */
18
+ ctx?: ExpandHintCtx & { executionStarted?: boolean },
19
19
  ) {
20
+ if (ctx?.executionStarted === false) language = undefined;
20
21
  type Slot = { code: string; language: string | undefined; theme: typeof theme; styled: string };
21
22
  let slot = state.commandPreview as Slot | undefined;
22
23
  if (!slot || slot.code !== code || slot.language !== language || slot.theme !== theme) {
23
- slot = { code, language, theme, styled: theme.fg("dim", code) };
24
+ slot = { code, language, theme, styled: language ? theme.fg("dim", code) : code };
24
25
  state.commandPreview = slot;
25
26
  const pending = slot;
26
- void hlBlock(code, language, theme).then(
27
- (lines) => {
28
- if (state.commandPreview !== pending) return;
29
- pending.styled = lines.join("\n");
30
- invalidate();
31
- },
32
- () => {
33
- /* Plain text remains available if highlighting fails. */
34
- },
35
- );
27
+ if (language)
28
+ void hlBlock(code, language, theme).then(
29
+ (lines) => {
30
+ if (state.commandPreview !== pending) return;
31
+ const styled = lines.join("\n");
32
+ if (pending.styled === styled) return;
33
+ pending.styled = styled;
34
+ invalidate();
35
+ },
36
+ () => {
37
+ /* Plain text remains available if highlighting fails. */
38
+ },
39
+ );
36
40
  }
37
41
  const current = slot;
38
42
  let replacement: string | undefined;