fix(search): give the in-place search a usable shortcut

kitty_mod+shift+f is the same physical key as kitty_mod+f, and
move_window_forward accepts the shifted fallback, so both definitions resolved
to the same trigger and the last one won: Ctrl+Shift+F moved the window instead
of opening the prompt, and the search had no shortcut at all. It now sits on
kitty_mod+alt+s, which no other default action claims.

Fixes #45
This commit is contained in:
BlackAngelTV committed 2026-12-03 10:21:00 +01:00
1 parent b036fb352e
commit 17462f5198
6 files changed
+25 -5

No files matched your search

+2 -1
View File
@@ -81,7 +81,8 @@ Deux fonctions FWS ne demandent aucune touche :
| `Ctrl+Shift+X` | Va au prompt suivant. | | `Ctrl+Shift+X` | Va au prompt suivant. |
| `Ctrl+Shift+H` | Affiche tout l'historique dans un pager. | | `Ctrl+Shift+H` | Affiche tout l'historique dans un pager. |
| `Ctrl+Shift+G` | Affiche la sortie de la dernière commande dans un pager. | | `Ctrl+Shift+G` | Affiche la sortie de la dernière commande dans un pager. |
| `Ctrl+Shift+/` | Recherche dans l'historique. | | `Ctrl+Shift+/` | Recherche dans l'historique dans un pager. |
| `Ctrl+Shift+Alt+S` | Recherche avec surlignage sur place (`n`/`N` pour naviguer, `Échap` pour quitter). |
## Fenêtres ## Fenêtres
+3 -1
View File
@@ -30,7 +30,9 @@ Search scrollback in place :sc:`search_scrollback_prompt`
========================== ======================= ========================== =======================
The in-place search highlights every match without replacing the screen with a The in-place search highlights every match without replacing the screen with a
pager. Prefix the query with ``\c`` to match case sensitively and with ``\r`` pager. It is bound to :kbd:`kitty_mod+alt+s` (:kbd:`Ctrl+Shift+Alt+S` by
default) and can also be run with :code:`kitten @ action
search_scrollback_prompt`. Prefix the query with ``\c`` to match case sensitively and with ``\r``
to use a regular expression; both modifiers can be combined. Write a doubled to use a regular expression; both modifiers can be combined. Write a doubled
backslash (``\\c``, ``\\r``) to search for those prefixes literally. While the search backslash (``\\c``, ``\\r``) to search for those prefixes literally. While the search
is active, :kbd:`n` jumps to the next match, :kbd:`N` to the previous one and is active, :kbd:`n` jumps to the next match, :kbd:`N` to the previous one and
+5
View File
@@ -263,6 +263,11 @@ Detailed list of changes
:kbd:`kitty_mod+H` is pressed. The panel can also be started with :kbd:`kitty_mod+H` is pressed. The panel can also be started with
:code:`kitty +kitten help`. :code:`kitty +kitten help`.
- The in-place scrollback search got a usable default shortcut: it was bound
to :kbd:`kitty_mod+shift+f`, the same physical key as :ac:`move_window_forward`
(which allows the shifted fallback), so the last definition won and the search
never opened. It is now on :kbd:`kitty_mod+alt+s`.
- The keyboard shortcuts panel ellipsizes a long action name inside its own - The keyboard shortcuts panel ellipsizes a long action name inside its own
column instead of letting the edge of the dock cut it, shrinks its key column column instead of letting the edge of the dock cut it, shrinks its key column
on very narrow docks so that a row always fits, and shows the full name of on very narrow docks so that a row always fits, and shows the full name of
+3 -2
View File
@@ -4159,13 +4159,14 @@ map('Search the scrollback within a pager', 'search_scrollback --allow-fallback=
map( map(
'Search and highlight the scrollback in place', 'Search and highlight the scrollback in place',
'search_scrollback_prompt kitty_mod+shift+f search_scrollback_prompt', 'search_scrollback_prompt kitty_mod+alt+s search_scrollback_prompt',
long_text=""" long_text="""
Search the scrollback without opening a pager. Every match is highlighted in Search the scrollback without opening a pager. Every match is highlighted in
the scrollback and the ``[current/total]`` counter is shown in the window title. the scrollback and the ``[current/total]`` counter is shown in the window title.
Prefix the query with ``\\c`` to match case sensitively and with ``\\r`` to use Prefix the query with ``\\c`` to match case sensitively and with ``\\r`` to use
a regular expression. While a search is active, :kbd:`n` and :kbd:`N` jump to a regular expression. While a search is active, :kbd:`n` and :kbd:`N` jump to
the next and previous match and :kbd:`Escape` ends the search. the next and previous match and :kbd:`Escape` ends the search. The default
binding is :kbd:`kitty_mod+alt+s` (:kbd:`Ctrl+Shift+Alt+S` by default).
The :ac:`scrollback_search_next`, :ac:`scrollback_search_prev` and The :ac:`scrollback_search_next`, :ac:`scrollback_search_prev` and
:ac:`clear_scrollback_search` actions can be mapped to other keys. :ac:`clear_scrollback_search` actions can be mapped to other keys.
+1 -1
View File
@@ -937,7 +937,7 @@ defaults.map = [
# search_scrollback # search_scrollback
KeyDefinition(trigger=SingleKey(mods=256, key=47), definition='search_scrollback'), KeyDefinition(trigger=SingleKey(mods=256, key=47), definition='search_scrollback'),
# search_scrollback_prompt # search_scrollback_prompt
KeyDefinition(trigger=SingleKey(mods=257, key=102), definition='search_scrollback_prompt'), KeyDefinition(trigger=SingleKey(mods=258, key=115), definition='search_scrollback_prompt'),
# new_window # new_window
KeyDefinition(trigger=SingleKey(mods=256, key=57345), definition='new_window'), KeyDefinition(trigger=SingleKey(mods=256, key=57345), definition='new_window'),
# new_os_window # new_os_window
+11
View File
@@ -29,6 +29,17 @@ class TestConfParsing(BaseTest):
def test_conf_parsing(self): def test_conf_parsing(self):
conf_parsing(self) conf_parsing(self)
def test_default_search_shortcut(self):
from kitty.config import load_config
opts = load_config(overrides=())
keymap = opts.keyboard_modes[''].keymap
keys = [key for key, defns in keymap.items() if any(d.definition.split()[0] == 'search_scrollback_prompt' for d in defns)]
self.ae(len(keys), 1, 'the in-place search must have exactly one default shortcut')
# A shared trigger means the last definition wins silently and the search
# never opens, which is what happened with move_window_forward.
self.ae([d.definition.split()[0] for d in keymap[keys[0]]], ['search_scrollback_prompt'])
def test_launcher(self): def test_launcher(self):
launcher(self) launcher(self)