fix(tui): let AltGr-typed "/" reach the composer instead of opening help (#4723) - #4977
Open
yyyCode wants to merge 1 commit into
Open
fix(tui): let AltGr-typed "/" reach the composer instead of opening help (#4723)#4977yyyCode wants to merge 1 commit into
yyyCode wants to merge 1 commit into
Conversation
On Windows, AltGr is reported to applications as Ctrl+Alt. On the Brazilian ABNT2 layout `/` is AltGr+Q, which arrives as Ctrl+Alt+Q and was matched against the global `Ctrl-/` help chord, so the help overlay opened every time the user tried to type a slash. AZERTY and other Latin layouts hit the same class of bug for characters behind AltGr. `is_help_shortcut` now treats any AltGr chord as text and falls through to the composer, reusing the platform-gated `key_hint::is_altgr` primitive the composer's own `is_plain_char` guard already uses so the two agree exactly on what counts as text. Plain `Ctrl-/` still opens help, `Alt+?` stays live, and off Windows a genuine `Ctrl+Alt+/` chord is unaffected. Same philosophy as the sidebar-focus AltGr fix in Hmbown#2863/Hmbown#2867, extended to the one global chord it missed. Adds platform-split regression tests and a KEYBINDINGS.md note on the AltGr behavior. Fixes Hmbown#4723. Reported-by: @nicolassmotta
Contributor
|
Thanks @yyyCode for taking the time to contribute. This repository is observing a maintainer-managed PR intake gate in dry-run mode, so this pull request is staying open. This note helps maintainers prepare the allowlist before any enforcement is considered. Please read |
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
Fixes #4723.
On Windows, AltGr is reported to applications as
Ctrl+Alt. On the Brazilian ABNT2 layout/isAltGr+Q, which arrives asCtrl+Alt+Qand was matched against the globalCtrl-/help chord — so the help overlay opened every time the reporter tried to type a slash. AZERTY and other Latin layouts hit the same class of bug for characters behind AltGr. The reporter isolated it cleanly:AltGr+W(?) works because there's noCtrl-?binding, so only theCtrl-/chord is affected.This is the same bug class as the sidebar-focus AltGr fix in #2863/#2867, which scoped its fix to
Alt-!/Alt-@/etc. but not the one global chord (Ctrl-/) that this issue hits.Fix
is_help_shortcut(crates/tui/src/tui/shell_key_routing.rs) now treats any AltGr chord as text and falls through to the composer, instead of matching it as help. It reuses the existing platform-gatedkey_hint::is_altgrprimitive that the composer's ownis_plain_charguard already uses, so the help matcher and the composer agree exactly on what counts as layout text. Once the overlay stops stealing the key, the composer inserts the literal/(AltGr chords already qualify as plain text on Windows viakey_hint::has_ctrl_or_alt).Behavior preserved:
Ctrl-/still opens help.Ctrl-7/Ctrl-_unit-separator fallbacks still open help.Alt+?stays live (Alt-only, not AltGr).is_altgris alwaysfalse, so a genuineCtrl+Alt+/chord is unaffected.Also adds a KEYBINDINGS.md note documenting the AltGr behavior (issue was tagged
documentation).Testing
Full disclosure: this machine has no MSVC toolchain installed (
mimalloc-syscan't build under the gnu toolchain either), so I could not run the workspacecargogates locally. What I did verify:rustfmt --edition 2024 --checkclean on the changed Rust fileis_help_shortcutinto a standalone harness (replicating crosstermKeyModifierssemantics) and asserting all chords for both Windows and non-Windowsis_altgrbehavior — all passscripts/check-coauthor-trailers.pypassescargo fmt --all -- --check— not run locally (no MSVC)cargo clippy --workspace ...— not run locally (no MSVC)cargo test --workspace ...— not run locally (no MSVC); please rely on CI for the added regression testsAdded regression tests are platform-split:
altgr_typed_slash_is_text_not_the_help_chord(#[cfg(windows)]) — AltGr/,7,_fall through; plainCtrl-/still opens help.ctrl_alt_slash_still_opens_help_off_windows(#[cfg(not(windows))]) — genuineCtrl+Alt+/still opens help.Checklist
Co-authored-bytrailers added (agent-assisted; issue reporter credited viaReported-by)