@xynogen/pix-display 0.1.8 → 0.1.9

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/code-blocks.ts +10 -15
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xynogen/pix-display",
3
- "version": "0.1.8",
4
- "description": "Pi core extension — paste chips, thinking blocks, and framed code rendering",
3
+ "version": "0.1.9",
4
+ "description": "Pi core extension \u2014 paste chips, thinking blocks, and framed code rendering",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
7
7
  "scripts": {
@@ -87,13 +87,10 @@ function bodyLine(
87
87
  layoutIndent: number,
88
88
  theme: CodeFrameTheme,
89
89
  ): string {
90
- const innerWidth = Math.max(1, width - 4);
91
- const content = truncateToWidth(stripLayoutWhitespace(line, layoutIndent), innerWidth, "…");
92
- const padding = " ".repeat(Math.max(0, innerWidth - visibleWidth(content)));
93
- return paintFrame(
94
- theme,
95
- `${theme.fg("borderMuted", "│")} ${content}${padding} ${theme.fg("borderMuted", "│")}`,
96
- );
90
+ const content = truncateToWidth(stripLayoutWhitespace(line, layoutIndent), width, "…");
91
+ // Keep every code row free of frame glyphs and layout padding. Selection must
92
+ // copy only source text, including meaningful relative indentation in Python.
93
+ return paintFrame(theme, content);
97
94
  }
98
95
 
99
96
  /**
@@ -117,13 +114,11 @@ export function renderCodeFences(lines: string[], width: number, theme: CodeFram
117
114
  const pad = Math.min(leadingSpaces(out[start] ?? ""), Math.floor((width - 12) / 2));
118
115
  const frameWidth = Math.max(12, width - pad * 2);
119
116
  const body = out.slice(start + 1, end);
120
- const bodyIndent = Math.min(
121
- ...body
122
- .map((line) => plainText(line))
123
- .filter((line) => line.trim().length > 0)
124
- .map((line) => leadingSpaces(line)),
125
- pad,
126
- );
117
+ const bodyIndents = body
118
+ .map((line) => plainText(line))
119
+ .filter((line) => line.trim().length > 0)
120
+ .map((line) => leadingSpaces(line));
121
+ const bodyIndent = bodyIndents.length > 0 ? Math.min(...bodyIndents) : 0;
127
122
  const left = " ".repeat(pad);
128
123
  const right = " ".repeat(Math.max(0, width - pad - frameWidth));
129
124
  const framed: string[] = [];
@@ -133,7 +128,7 @@ export function renderCodeFences(lines: string[], width: number, theme: CodeFram
133
128
  );
134
129
  for (let index = start + 1; index < end; index++) {
135
130
  framed.push(
136
- `${oscSequences(out[index] ?? "")}${left}${bodyLine(out[index] ?? "", frameWidth, bodyIndent, theme)}${right}`,
131
+ `${oscSequences(out[index] ?? "")}${bodyLine(out[index] ?? "", width, bodyIndent, theme)}`,
137
132
  );
138
133
  }
139
134
  framed.push(`${oscSequences(out[end] ?? "")}${left}${bottomBorder(frameWidth, theme)}${right}`);