Skip to content

fix(tui): recognise tagged grep hits - #427

Merged
mrnasil merged 1 commit into
mainfrom
fix/tui-tagged-grep-hits
Nov 7, 2026
Merged

mrnasil merged 1 commit into
mainfrom
fix/tui-tagged-grep-hits

Conversation

@mrnasil

@mrnasil mrnasil commented Nov 7, 2026

Copy link
Copy Markdown
Member

Found while reviewing tool output formats for the token-efficiency series (#418–#426). This is the grep counterpart of the read-line fix in #424.

Problem

The grep tool writes path:148 vp:text, with a line tag between the number and the separator (the model's edit anchor). The TUI's parse_grep_hit expected : or - immediately after the digits, so it matched none of these lines. As a result:

  • grep results were painted as plain text, without per-file headers, the line-number gutter or match highlighting;
  • the header chip ((N matches in M files)) could not count files.

Change

parse_grep_hit now skips an alphanumeric tag after the line number. Untagged path:12:text / path:12-text lines (ripgrep style, ast_grep) still parse as before.

Checks

  • parse_grep_hit_match_and_context now also covers a tagged match, a tagged context line, and a bare space with no tag (rejected).
  • New test grep_summary_counts_tagged_hits: (3 matches in 2 files).
  • whycodes-tui --lib 1495 passed; fmt and clippy are ok.

🤖 Generated with Claude Code

The grep tool writes `path:148 vp:text`, with a line tag between the
number and the separator. The TUI's `parse_grep_hit` expected `:` or `-`
right after the digits, so it matched none of those lines: grep results
were painted as plain text, without the per-file headers, line gutter or
match highlighting, and the header chip could not count files.

The parser now skips an alphanumeric tag after the line number.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@mrnasil
mrnasil force-pushed the fix/tui-tagged-grep-hits branch from 42e36a9 to 69500cc Compare November 7, 2026 14:31
@mrnasil
mrnasil merged commit 8a4cf48 into main Nov 7, 2026
7 checks passed
@mrnasil
mrnasil deleted the fix/tui-tagged-grep-hits branch November 7, 2026 14:40
@mrnasil mrnasil mentioned this pull request Nov 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant