fix(search): allow searching for a literal \c or \r #52

Merged
BlackAngelTV merged 2 commits from fix/search-literal-escapes into main 2026-12-03 10:01:54 +01:00
Owner

Summary

The in-place search query parser treated a leading \c and \r as modifiers with no way to escape them, so those strings themselves could not be searched: the query became empty and the prompt failed with "the search query is empty".

A doubled backslash now ends the modifier section and stands for the literal backslash, so \\c and \\r search for the text. Modifiers still combine with an escaped prefix (\c\\r is a case sensitive search for \r).

Changes

  • kitty/scrollback_search.py: escape handling in parse_query().
  • kitty/window.py: the search prompt and the action help document the escaping.
  • docs/basic.rst, docs/changelog.rst: same for the documentation.
  • kitty_tests/scrollback_search.py: parsing and matching tests for the escaped prefixes.

Tests

  • python3 -m unittest kitty_tests.scrollback_search
  • ruff check and ruff format --check on the touched Python files

Fixes #48

## Summary The in-place search query parser treated a leading `\c` and `\r` as modifiers with no way to escape them, so those strings themselves could not be searched: the query became empty and the prompt failed with "the search query is empty". A doubled backslash now ends the modifier section and stands for the literal backslash, so `\\c` and `\\r` search for the text. Modifiers still combine with an escaped prefix (`\c\\r` is a case sensitive search for `\r`). ## Changes - `kitty/scrollback_search.py`: escape handling in `parse_query()`. - `kitty/window.py`: the search prompt and the action help document the escaping. - `docs/basic.rst`, `docs/changelog.rst`: same for the documentation. - `kitty_tests/scrollback_search.py`: parsing and matching tests for the escaped prefixes. ## Tests - `python3 -m unittest kitty_tests.scrollback_search` - `ruff check` and `ruff format --check` on the touched Python files Fixes #48
BlackAngelTV added 2 commits 2026-12-03 10:01:52 +01:00
A query that starts with one of the two modifier prefixes could not be
escaped, so the text itself was unreachable: \c and \r were always consumed
as modifiers and the query ended up empty. A doubled backslash now ends the
modifier section and stands for the literal backslash, and the help line and
the docs document it.

Fixes #48
chore(release): bump the fork version to 0.1.10
CI / check (pull_request) Failing after 11m10s
4ca4a516ae
The search fix changes shipped behaviour, so cut a patch release. All the
version copies must agree for the packaging workflow.
BlackAngelTV merged commit b406be9394 into main 2026-12-03 10:01:54 +01:00
BlackAngelTV deleted branch fix/search-literal-escapes 2026-12-03 10:01:54 +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#52