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

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
This commit is contained in:
BlackAngelTV committed 2026-12-03 10:01:34 +01:00
1 parent 1bd822b9e5
commit f616651c49
5 files changed
+37 -6

No files matched your search

+6 -2
View File
@@ -2676,7 +2676,8 @@ class Window:
'sc',
"""
Search the scrollback in place, highlighting every match. Prefix the query with \\c for a case
sensitive search and with \\r for a regular expression. Matches are navigated with n and N and
sensitive search and with \\r for a regular expression. To search for those two strings literally,
write a double backslash instead (``\\\\c`` and ``\\\\r``). Matches are navigated with n and N and
the search ends with Escape. The [current/total] counter is shown in the window title.
""",
)
@@ -2691,7 +2692,10 @@ class Window:
self.clear_scrollback_search()
get_boss().get_line(
_('Search the scrollback. Prefix the query with \\c for a case sensitive search and \\r for a regular expression.'),
_(
'Search the scrollback. Prefix the query with \\c for a case sensitive search and \\r for a regular expression.'
' Write a double backslash to search for those strings literally.'
),
done,
window=self,
prompt=_('search> '),