@xynogen/pix-display 0.1.0 → 0.1.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-display",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Pi core extension — paste chip rendering and thinking block display",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -52,6 +52,10 @@ const PATH_RE = /(^|[^\w/])((?:~|\/)[^\s,;'"(){}[\]]+)/g;
52
52
  // Pi's marker grammar — must match exactly for atomic segmentation.
53
53
  // e.g. `[paste #1 58 chars]` or `[paste #2 +42 lines]`
54
54
  const MARKER_RE = /\[paste #(\d+)( (\+(\d+) lines|(\d+) chars))?\]/g;
55
+ // Cursor inversion codes the TUI Editor embeds when the cursor intersects
56
+ // a marker. Strip them before matching — Pi re-wraps each render call, so
57
+ // width-preserving is not required.
58
+ const CURSOR_RE = /\x1b\[[0-9;]*m/g;
55
59
 
56
60
  // ─── Helpers ──────────────────────────────────────────────────────────────────
57
61
 
@@ -107,7 +111,10 @@ function replaceImagePaths(
107
111
  * Width-preserving is not required — Pi re-wraps each render call.
108
112
  */
109
113
  export function restyleMarkers(line: string, imageIds: Set<number>): string {
110
- return line.replace(
114
+ // Strip cursor inversion codes the TUI embeds when the cursor
115
+ // intersects a marker — plain MARKER_RE handles the rest.
116
+ const clean = line.includes("\x1b") ? line.replace(CURSOR_RE, "") : line;
117
+ return clean.replace(
111
118
  MARKER_RE,
112
119
  (_full, idStr, _g2, _g3, linesStr, charsStr) => {
113
120
  const id = Number.parseInt(idStr, 10);