Skip to content

Fixes #4878 - Use first unbound F-key for UICatalog StatusBar toggle instead of hardcoded F10 - #4895

Merged
tig merged 6 commits into
developfrom
copilot/fix-f10-statusbar-issue
Apr 8, 2026
Merged

Fixes #4878 - Use first unbound F-key for UICatalog StatusBar toggle instead of hardcoded F10#4895
tig merged 6 commits into
developfrom
copilot/fix-f10-statusbar-issue

Conversation

Copilot AI commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

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

  • Add GetFirstUnboundFKey() to UICatalogRunnable that scans F1–F12 and returns the first key not bound in:
    • Application.KeyBindings (catches F5/Refresh, F6/NextTabGroup, etc.)
    • MenuBar.DefaultKey (F10) and PopoverMenu.DefaultKey (Shift+F10)
    • MenuBar menu items via GetMenuItemsWith() (catches F1/Documentation, F2/README)
  • Replace Key.F10 with GetFirstUnboundFKey() in CreateStatusBar()

With the current UICatalog config, this resolves to F3.

Pull Request checklist:

  • I've named my PR in the form of "Fixes #issue. Terse description."
  • My code follows the style guidelines of Terminal.Gui - if you use Visual Studio, hit CTRL-K-D to automatically reformat your files before committing.
  • My code follows the Terminal.Gui library design guidelines
  • I ran dotnet test before commit
  • I have made corresponding changes to the API documentation (using /// style comments)
  • My changes generate no new warnings
  • I have checked my code and corrected any poor grammar or misspellings
  • I conducted basic QA to assure all features are working

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
Copilot finished work on behalf of tig April 7, 2026 15:58
Copilot AI requested a review from tig April 7, 2026 15:58
@tig tig changed the title Fixes #4069. Use first unbound F-key for UICatalog StatusBar toggle instead of hardcoded F10 Fixes #4878 - Use first unbound F-key for UICatalog StatusBar toggle instead of hardcoded F10 Apr 7, 2026
@tig
tig marked this pull request as ready for review April 7, 2026 16:05
@tig
tig requested a review from Copilot April 7, 2026 16:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.F10 StatusBar 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 = () =>

Comment thread Examples/UICatalog/UICatalogRunnable.cs Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

F10 StatusBar shortcut conflicts with menu toggle, does not work

3 participants