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.
- package/package.json +1 -1
- package/src/hashline.ts +4 -3
package/package.json
CHANGED
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 =
|
|
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
|
|
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 =
|
|
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"
|