pi-readseek 0.4.19 → 0.4.20

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 +1 -1
  2. package/src/hashline.ts +4 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-readseek",
3
- "version": "0.4.19",
3
+ "version": "0.4.20",
4
4
  "description": "Pi extension for readseek-backed hash-anchored read/edit/grep, structural code maps, structural search, and file exploration",
5
5
  "type": "module",
6
6
  "exports": {
package/src/hashline.ts CHANGED
@@ -58,7 +58,7 @@ const RADIX = 16;
58
58
  const HASH_MOD = RADIX ** HASH_LEN;
59
59
  const DICT = Array.from({ length: HASH_MOD }, (_, i) => i.toString(RADIX).padStart(HASH_LEN, "0"));
60
60
 
61
- const HASHLINE_PREFIX_RE = /^\d+:[0-9a-zA-Z]{1,16}\|/;
61
+ const HASHLINE_PREFIX_RE = /^[\s>]*\d+:[0-9a-zA-Z]{1,16}\|/;
62
62
  const DIFF_PLUS_RE = /^\+(?!\+)/;
63
63
  const HASH_ONLY_PREFIX_RE = /^[0-9a-f]{3}\|/;
64
64
  const HASH_RELOCATION_WINDOW_BASE = 20;
@@ -119,9 +119,10 @@ export function formatHashlineDisplay(lineNumber: number, content: string): stri
119
119
  }
120
120
 
121
121
  export function parseLineRef(ref: string): { line: number; hash: string; content?: string } {
122
- const contentMatch = ref.match(/^[^|]*\|(.*)$/);
122
+ const firstLine = ref.split(/\r?\n/, 1)[0]; // an anchor is one line; ignore any pasted trailing lines
123
+ const contentMatch = firstLine.match(/^[^|]*\|(.*)$/);
123
124
  const contentAfterPipe = contentMatch ? contentMatch[1] : undefined;
124
- const cleaned = ref
125
+ const cleaned = firstLine
125
126
  .replace(/\|.*$/, "") // drop |content suffix
126
127
  .replace(/^[\s>]+/, "") // drop leading gutter: >> / >>> / indentation
127
128
  .replace(/ {2}.*$/, "") // drop trailing " comment"