pi-readseek 0.4.18 → 0.4.19
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 +1 -1
- package/src/hashline.ts +5 -1
package/package.json
CHANGED
package/src/hashline.ts
CHANGED
|
@@ -121,7 +121,11 @@ export function formatHashlineDisplay(lineNumber: number, content: string): stri
|
|
|
121
121
|
export function parseLineRef(ref: string): { line: number; hash: string; content?: string } {
|
|
122
122
|
const contentMatch = ref.match(/^[^|]*\|(.*)$/);
|
|
123
123
|
const contentAfterPipe = contentMatch ? contentMatch[1] : undefined;
|
|
124
|
-
const cleaned = ref
|
|
124
|
+
const cleaned = ref
|
|
125
|
+
.replace(/\|.*$/, "") // drop |content suffix
|
|
126
|
+
.replace(/^[\s>]+/, "") // drop leading gutter: >> / >>> / indentation
|
|
127
|
+
.replace(/ {2}.*$/, "") // drop trailing " comment"
|
|
128
|
+
.trim();
|
|
125
129
|
const normalized = cleaned.replace(/\s*:\s*/, ":");
|
|
126
130
|
const match = normalized.match(new RegExp(`^(\\d+):([0-9a-fA-F]{${HASH_LEN}})$`));
|
|
127
131
|
if (!match) throw new Error(`Invalid line reference "${ref}". Expected "LINE:HASH" (e.g. "5:abc").`);
|