fix(core): preserve unicode in grep previews (#42356)

This commit is contained in:
Kit Langton
2026-08-13 12:51:43 -04:00
committed by GitHub
parent ab7cbc808f
commit 6c035e1fd7
2 changed files with 24 additions and 1 deletions
+4 -1
View File
@@ -264,7 +264,10 @@ const layer = Layer.effect(
}),
line: match.line_number,
offset: match.absolute_offset,
text: match.lines.text.length > 2_000 ? match.lines.text.slice(0, 2_000) + "..." : match.lines.text,
text:
match.lines.text.length > 2_000
? match.lines.text.slice(0, 2_000).replace(/[\uD800-\uDBFF]$/, "") + "..."
: match.lines.text,
submatches: match.submatches.map((submatch) => ({
text: submatch.match.text,
start: submatch.start,