UI hints follow the keymap (pane labels + dialog shortcuts); drop quit from user keymap#231
Merged
Merged
Conversation
Two related fixes for the "edit keymap.json, see the UI update"
promise.
1. **Textual's hardcoded `App.BINDINGS` slipped past the keymap.**
Pressing `ctrl+q` quit sqlit even when a user remapped `quit` to
`ctrl+c`, because the framework's default `Binding("ctrl+q",
"quit", priority=True)` had no `id=` and so wasn't reachable by
`App.set_keymap`. SSMSTUI now declares `inherit_bindings=False`
and re-declares the quit binding with `id="quit"`, so the keymap
actually controls it.
2. **UI hints (pane labels and dialog shortcuts) showed stale keys.**
- Pane border labels (`[e] Explorer`, `[q] Query`, `[r] Results`)
in `ui_status.py` were hardcoded; now they pull from the keymap
so remapping `focus_explorer` to `E` updates the border to match.
- `ValueViewScreen`, `ErrorScreen`, and `ConnectionScreen` dialog
hints (`Copy: y`, `Test: ^t`, `Save: ^s`, …) also pulled from
hardcoded strings; now derived from the keymap.
To make screen-local actions (`error_copy_message`,
`connection_save`, `connection_test`, `connection_install_driver`)
reachable from the keymap without polluting the action validator,
adds two new screen-local contexts (`error_dialog`,
`connection_editor`) and a skip-list in `validate_actions` for
contexts whose action methods live on a Screen instead of the App.
Drops the prior approach of shadowing Textual's App.BINDINGS to make ctrl+q remappable. The friction wasn't worth it — quit is a key nobody benefits from rebinding, and giving it the special treatment opens a foot-gun where a typo in keymap.json could lock the user out of the exit key. - Reverts SSMSTUI back to default inherit_bindings behavior. Textual's built-in ctrl+q -> quit and ctrl+c -> help_quit stay as the only routes (plus the :q command-mode form). - Removes `quit` from sqlit's user-overridable keymap defaults (both the action_keys entry and the <leader>q LeaderCommand). - Regenerates config/keymap.template.json to match. - Updates tests that previously used 'quit' as a sample action.
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.
Two related fixes so the keymap actually drives what the user sees in the UI.
1. UI hints showed stale keys. The pane border labels (
[e] Explorer,[q] Query,[r] Results) inui_status.pywere hardcoded. Remappingfocus_explorertoEleft the border still showing[e]. Same problem in three dialog shortcut hints:ValueViewScreen—Copy: y,Toggle: t,Collapse: zErrorScreen—Copy: yConnectionScreen—Test: ^t,Save: ^sAll now read from the keymap.
2. Quit is no longer user-overridable. The earlier attempt to make
ctrl+qkeymap-driven (by overriding Textual'sApp.BINDINGS) is reverted — quit is the kind of key nobody benefits from rebinding, and giving it special treatment created a foot-gun where a typo inkeymap.jsoncould lock the user out of the exit key. Textual's hardcodedctrl+q -> quitandctrl+c -> help_quitstay as the only routes (plus the:qcommand).To support screen-local actions (
error_copy_message,connection_save,connection_test,connection_install_driver) cleanly, adds two new contexts (error_dialog,connection_editor) and teaches the action validator to skip them — their action methods live on the Screen, not the App.