Skip to content

Search highlights should expose visible ranges after line clamping #3557

Description

@Widthdom

Summary

Search highlight occurrence columns are based on the original source line, while the returned snippet line may be clamped. Clients cannot tell whether a term occurrence is visible in the returned text or hidden behind a clamp marker.

Current source evidence

  • SearchHighlight includes OriginalLineLength, Truncated, TermOccurrences, and Text.
  • SearchTermOccurrence has original line, column, and length, but no visible/clamped span mapping.

Proposed improvement

Add visible-range metadata for highlight terms, such as visible, visible_column, visible_length, or a line-level original-to-snippet span map.

Acceptance notes

  • Original coordinates remain available for source navigation.
  • Returned metadata is enough to highlight only visible text in compact snippets.
  • Tests cover a long line where one occurrence is visible and another is truncated away.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions