3 Commits
Author SHA1 Message Date
dualfroz fec3a2ee9f Describe this repository 2026-10-22 21:03:10 +02:00
dualfroz 2dfffab549 fix(grep): locate code by measuring the grep line prefix
get_code_style_sections rebuilt the "path<sep>[line-number<sep>]" prefix
from the parsed path and line number in order to find where the code
starts in the raw line. That reconstruction can be shorter than the text
which was actually printed: the parsed line number does not record the
width of its own text, so an input "007" is rebuilt as "7", and a parsed
path may contain a tab, which has already been expanded in the raw line.

The slice then started inside the prefix, so the style sections described
a different string than the parsed code, and superimpose panicked with
"String mismatch encountered while superimposing style sections".

Measure the prefix instead: the code is the tail of the line the parser
was given, so the prefix is everything before it, and expanding its tabs
gives its width in the tab-expanded raw line. For a well formed grep line
the result is identical to the previous computation.
2026-09-03 13:42:11 +02:00
upstream be2aa5e15a Upstream dandavison/delta state of the touched files before 0e4e460aa7 2026-09-03 13:42:11 +02:00