feat(search): highlight the current match in its own color #53

Merged
BlackAngelTV merged 2 commits from feat/search-current-match into main 2026-12-03 10:06:07 +01:00
Owner

Summary

All occurrences of an in-place scrollback search were highlighted identically, so the current match could only be found through the [current/total] counter in the window title.

The current match now uses the second mark color (mark2_*) while the other matches keep the first one, and the marker is rebuilt on every n/N jump. Escape still restores the previous marker.

Changes

  • kitty/scrollback_search.py: ScrollbackSearch.current_match and marker_spans(), which groups the spans by line text and colors the current one.
  • kitty/marks.py: marker_from_spans() avoids re-running the query for every line.
  • kitty/window.py: the search marker is built from the spans and refreshed when the index moves.
  • docs/basic.rst, docs/changelog.rst and the action help describe the two colors.

Marker functions are called once per line without its number, so the lookup is done by line text; identical lines are highlighted alike, which is indistinguishable on screen.

Tests

  • python3 -m unittest kitty_tests.scrollback_search (index tracking, colors, wrapping)
  • ruff check / ruff format --check

Fixes #51

## Summary All occurrences of an in-place scrollback search were highlighted identically, so the current match could only be found through the `[current/total]` counter in the window title. The current match now uses the second mark color (`mark2_*`) while the other matches keep the first one, and the marker is rebuilt on every `n`/`N` jump. `Escape` still restores the previous marker. ## Changes - `kitty/scrollback_search.py`: `ScrollbackSearch.current_match` and `marker_spans()`, which groups the spans by line text and colors the current one. - `kitty/marks.py`: `marker_from_spans()` avoids re-running the query for every line. - `kitty/window.py`: the search marker is built from the spans and refreshed when the index moves. - `docs/basic.rst`, `docs/changelog.rst` and the action help describe the two colors. Marker functions are called once per line without its number, so the lookup is done by line text; identical lines are highlighted alike, which is indistinguishable on screen. ## Tests - `python3 -m unittest kitty_tests.scrollback_search` (index tracking, colors, wrapping) - `ruff check` / `ruff format --check` Fixes #51
BlackAngelTV added 2 commits 2026-12-03 10:06:06 +01:00
Every match of the in-place search used the same mark color, so after pressing
n or N the only hint of the current match was the counter in the window title,
which is easy to miss on a short query or a dense screen. The marker now colors
the current match with the second mark color and keeps the rest on the first
one, rebuilding the marker whenever the index changes.

Fixes #51
chore(release): bump the fork version to 0.1.11
CI / check (pull_request) Successful in 10m3s
cbee630d4c
The scrollback search now renders differently, so cut a patch release. All the
version copies must agree for the packaging workflow.
BlackAngelTV merged commit d83fbc71e3 into main 2026-12-03 10:06:07 +01:00
BlackAngelTV deleted branch feat/search-current-match 2026-12-03 10:06:08 +01:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: FWS/FWS-Kitty#53