Problem#
A thread search match after a long run of Katakana still makes the server scan backward through the run and give the whole prefix to Intl.Segmenter. The formatter only needs enough context to find a safe place to start the snippet.
Change#
Recognize boundaries between Katakana block characters and the existing ASCII and Han ranges. Keep Unicode segmentation for cuts near flags and combining marks.
Scope#
Follow-up to #47404. The reproduction fits under the message limit.
Verification#
The regression test fails on base 6b12843cbe and passes with the fix. InstaBox passed all 42 ThreadSearch tests and check:changed with 44 tests. In Node 26, buildSearchSnippet("カ".repeat(119_000) + "needle", 119_000) returned the same snippet with three character reads instead of 118,978 and zero segmenter calls instead of one. The counts cover snippet generation.
GPT-6.2 Sol via Codex.
Evidence#
7b7ca65f)4fb4dcde)…カカカカカカカカカカカカカカカカカカカカカカカカneedleDriver: bench.mjs.