Fixes #4878 - Use first unbound F-key for UICatalog StatusBar toggle instead of hardcoded F10 - #4895
Merged
Merged
Conversation
…und F-key Agent-Logs-Url: https://github.com/gui-cs/Terminal.Gui/sessions/317766ed-2789-4b27-b3a9-63b856711aba Co-authored-by: tig <585482+tig@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix F10 shortcut conflict with StatusBar toggle
Fixes #4069. Use first unbound F-key for UICatalog StatusBar toggle instead of hardcoded F10
Apr 7, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Updates UICatalog’s StatusBar “Show/Hide” shortcut to avoid the F10 conflict with MenuBar.DefaultKey by selecting the first available unbound function key at runtime.
Changes:
- Added
GetFirstUnboundFKey ()to scan F1–F12 and pick the first key not currently bound at the Application/Menu level. - Replaced the hardcoded
Key.F10StatusBar toggle with the dynamically selected key.
Comments suppressed due to low confidence (1)
Examples/UICatalog/UICatalogRunnable.cs:781
- GetFirstUnboundFKey() is called before the StatusBar’s other shortcuts are created, but CreateStatusBar() later hard-binds F7 (force16ColorsShortcut). If F1–F6 ever become bound, this helper can return F7, creating a duplicate/conflicting shortcut key in the same StatusBar (and potentially an app-level binding because BindKeyToApplication=true on the F7 shortcut). Consider excluding keys that this status bar reserves (e.g., F7) or computing the unbound key after assembling all shortcuts.
_shVersion = new Shortcut { Title = "Version Info", CanFocus = false };
Shortcut statusBarShortcut = new () { Key = GetFirstUnboundFKey (), Title = "Show/Hide Status Bar", CanFocus = false, Action = () => ShowStatusBar = !ShowStatusBar };
_force16ColorsShortcutCb = new CheckBox
{
Title = "16 color mode", Value = Driver.Force16Colors ? CheckState.Checked : CheckState.UnChecked, CanFocus = true
};
Shortcut force16ColorsShortcut = new ()
{
CanFocus = false,
CommandView = _force16ColorsShortcutCb,
HelpText = "",
BindKeyToApplication = true,
Key = Key.F7,
Action = () =>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This was referenced May 1, 2026
This was referenced May 11, 2026
This was referenced May 21, 2026
This was referenced Jun 1, 2026
This was referenced Jul 13, 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.
Fixes
UICatalog's StatusBar "Show/Hide" shortcut was hardcoded to F10, which now conflicts with
MenuBar.DefaultKey(F10 toggles the menu bar). Pressing F10 opens the menu instead of toggling the status bar.Proposed Changes/Todos
GetFirstUnboundFKey()toUICatalogRunnablethat scans F1–F12 and returns the first key not bound in:Application.KeyBindings(catches F5/Refresh, F6/NextTabGroup, etc.)MenuBar.DefaultKey(F10) andPopoverMenu.DefaultKey(Shift+F10)GetMenuItemsWith()(catches F1/Documentation, F2/README)Key.F10withGetFirstUnboundFKey()inCreateStatusBar()With the current UICatalog config, this resolves to F3.
Pull Request checklist:
CTRL-K-Dto automatically reformat your files before committing.dotnet testbefore commit///style comments)