fix(tui): make Ctrl+L and Ctrl+N fire from chat input via priority bindings#450
Open
manuel-goepfi wants to merge 1 commit into
Open
Conversation
…ndings Screen-level `Binding(...)` declarations are consultative by default — focused widgets get first crack at every keypress and can swallow it. The chat input (a TextArea descendant) inherits readline-style bindings that consume Ctrl+L (clear-line) and Ctrl+N (next-line), so those keypresses never reach `action_toggle_ltm` / `action_new_chat`. The visible symptom was that pressing Ctrl+L appeared to do nothing until the user opened another modal (e.g. Ctrl+Shift+M model selection) which transferred focus off the input. After that modal closed, focus landed on the screen and Ctrl+L finally bubbled up to the binding. Adding `priority=True` to both bindings tells Textual to fire the screen action before the focused widget gets to consume the key, so the shortcut works regardless of where focus currently lives. Ctrl+Shift+M (change model), Ctrl+Shift+W (workstream), and Ctrl+C (stop streaming) keep their default priority: the first two are rare enough that no widget binds them; Ctrl+C in Textual is special-cased and elevating it could interfere with focus-aware copy/cancel flows.
mark-at-pieces
approved these changes
Apr 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Screen-level
Binding(...)declarations are consultative by default — focused widgets get first crack at every keypress and can swallow it. The chat input (aTextAreadescendant) inherits readline-style bindings that consume Ctrl+L (clear-line) and Ctrl+N (next-line), so those keypresses never reachaction_toggle_ltm/action_new_chat.The visible symptom was that pressing Ctrl+L appeared to do nothing until the user opened another modal (e.g. Ctrl+Shift+M model selection) which transferred focus off the input. After that modal closed, focus landed on the screen and Ctrl+L finally bubbled up to the binding.
Adding
priority=Trueto both bindings tells Textual to fire the screen action before the focused widget gets to consume the key, so the shortcut works regardless of where focus currently lives.Why not all bindings?
Ctrl+Shift+M (change model), Ctrl+Shift+W (workstream), and Ctrl+C (stop streaming) keep their default priority:
Test plan