Skip to content

[codex] Improve search match highlighting - #60

Merged
jlitola merged 3 commits into
mainfrom
swamp-level
May 5, 2026
Merged

[codex] Improve search match highlighting#60
jlitola merged 3 commits into
mainfrom
swamp-level

Conversation

@jlitola

@jlitola jlitola commented May 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Improves terminal search readability by separating header/path styling from search-match styling.

  • adds a yellow match-highlight style for backend-provided title and summary spans
  • keeps result targets and path headers cyan while highlighting matching query terms inside path segments
  • carries the backend query through search_status result payloads so async/follow-up output gets the same location highlighting
  • treats quoted query phrases as phrase terms for location highlighting, and prioritizes longer overlapping terms deliberately
  • updates grep/search formatter tests for the shared match-span color
  • fixes a minor optional-chain lint finding surfaced during validation

Why

Search output could match on file paths, but path matches were visually lost because both the header and highlight spans used the same cyan style. Yellow match spans make the actual matched term visible while preserving the existing header hierarchy.

Review Notes

Claude review cleanup addressed:

  • fixed the immediate-search vs search_status highlighting asymmetry by threading result.query.raw through status payloads
  • made length sorting observable by using longer-term priority when overlapping ranges compete
  • documented and implemented quoted-phrase behavior so quoted phrases do not degrade into scattered path word highlights
  • kept the optional-chain cleanup as the existing lint cleanup; the pushed history was not rewritten after PR creation

Validation

  • bun test
  • bun run typecheck
  • bun run format:check
  • bun run lint
  • bun run build
  • bun run smoke:cli
  • bun run smoke:mcp

Separate search match coloring from header/path styling so terminal output keeps query matches visible in titles, summaries, and path segments. Use yellow for matched spans while preserving cyan for headers.
@jlitola
jlitola marked this pull request as ready for review May 5, 2026 11:48
Carry the backend query through search-status result payloads so completed and partial follow-up output can apply the same location-term highlights as immediate search output.

Make fallback query-term highlighting deterministic by prioritizing longer overlapping terms, and preserve quoted phrases as phrase terms for path highlighting.
@jlitola
jlitola marked this pull request as draft May 5, 2026 11:59
@jlitola
jlitola marked this pull request as ready for review May 5, 2026 11:59
Document the reduced search-status query echo, make local term ordering explicit, preserve quoted terms verbatim for location highlighting, and lock longest-overlap behavior with CLI coverage.
@jlitola
jlitola marked this pull request as draft May 5, 2026 12:03
@jlitola
jlitola marked this pull request as ready for review May 5, 2026 12:03
@jlitola
jlitola merged commit 7f6a526 into main May 5, 2026
3 checks passed
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