Skip to content

[Shortcut Guide] Render key names instead of raw numeric key codes#48037

Merged
niels9001 merged 4 commits into
mainfrom
copilot/fix-number-not-showing-in-shortcut-guide
May 22, 2026
Merged

[Shortcut Guide] Render key names instead of raw numeric key codes#48037
niels9001 merged 4 commits into
mainfrom
copilot/fix-number-not-showing-in-shortcut-guide

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 21, 2026

Summary of the Pull Request

Shortcut Guide was rendering raw numeric key codes in key visuals for some shortcuts (notably generated PowerToys shortcuts), showing numbers where key characters/names were expected. This change normalizes numeric key handling so display output matches actual key labels.

PR Checklist

  • Communication: I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected
  • Tests: Added/updated and all pass
  • Localization: All end-user-facing strings can be localized
  • Dev docs: Added/updated
  • New binaries: Added on the required places
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

  • Scope

    • Updated ShortcutDescriptionToKeysConverter in ShortcutGuide.Ui only.
  • Behavior change

    • Numeric key codes are no longer passed through as raw integers by default.
    • Arrow keys (37/38/39/40) remain numeric to preserve existing glyph rendering behavior.
    • All other numeric key codes are converted to display names via Helper.GetKeyName(...).
  • Result

    • Shortcut Guide key caps now show expected characters/key names instead of numeric values for manifest-provided numeric keys.
if (int.TryParse(key, out int keyCode))
{
    switch (keyCode)
    {
        case 38:
        case 40:
        case 37:
        case 39:
            shortcutList.Add(keyCode); // keep glyph path
            break;
        default:
            shortcutList.Add(Helper.GetKeyName((uint)keyCode)); // show key label
            break;
    }
}

Validation Steps Performed

No additional validation details are included in this description.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • o3svsblobprodcus318.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build /home/REDACTED/work/PowerToys/PowerToys/src/modules/ShortcutGuide/ShortcutGuide.Ui/ShortcutGuide.Ui.csproj -v minimal (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Fix number display issue in shortcut guide key [Shortcut Guide] Render key names instead of raw numeric key codes May 21, 2026
Copilot AI requested a review from niels9001 May 21, 2026 15:40
@noraa-junker noraa-junker marked this pull request as ready for review May 21, 2026 21:09
Copy link
Copy Markdown
Collaborator

@noraa-junker noraa-junker left a comment

Choose a reason for hiding this comment

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

Tested and LGTM

@github-actions
Copy link
Copy Markdown

@check-spelling-bot Report

🔴 Please review

See the 📂 files view, the 📜action log, 👼 SARIF report, or 📝 job summary for details.

Unrecognized words (4)

DWRITE
LWIN
VCENTER
VREDRAW

These words are not needed and should be removed ABlocked AClient AColumn ACR ADate ADifferent AHybrid ALarger AModifier ANull AOklab APeriod ARandom ARemapped ASingle ASUS bck BNumber BOklab BVal BValue CAtl CCom CContext CDeclaration CElems Chunghwa CImage CMock CPower CSearch CSettings CSOT CStyle CTest CVal CVirtual DArchitectures DComposition defaulttonearest diu DSVG dwrite EAccess EFile EInvalid ENot EProvider ESettings FErase FInc FMask FNumber FRestore GNumber GValue Hann HHmmssfff Hostx HPhysical HSpeed HSync HVal HValue HWP IPREVIEW ITHUMBNAIL IVO kdc LExit LPCFHOOKPROC LPrivate LReader LUMA LVal lwin MMdd MRT MSHCTX MSHLFLAGS Nanjing newcolor NLog oldcolor outsourced PBlob PElems PHL pinboard PStr PToy QDS RAlt RAquadrant rectp RKey RNumber scanled suntimes Tianma UBreak UCallback UError UFlags UHash UMax UMin unsubscribes UOffset UType vcenter VDesktop vredraw VSpeed VSync WBounds WClass workerw WReserved XAxis XButton XDeployment XDimension XDocument XElement XFile XIncrement XLoc XNamespace XPels XPixel XPos XResource XSpeed XStr XTimer YAxis YDimension YIncrement YPels YPos YResolution YSpeed YStr YTimer

To accept these unrecognized words as correct and remove the previously acknowledged and now absent words, you could run the following commands

... in a clone of the git@github.com:microsoft/PowerToys.git repository
on the copilot/fix-number-not-showing-in-shortcut-guide branch (ℹ️ how do I use this?):

curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/cfb6f7e75bbfc89c71eaa30366d0c166f1bd9c8c/apply.pl' |
perl - 'https://github.com/microsoft/PowerToys/actions/runs/26253099705/attempts/1' &&
git commit -m 'Update check-spelling metadata'

OR

To have the bot accept them for you, comment in the PR quoting the following line:
@check-spelling-bot apply updates.

If the flagged items are 🤯 false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it,
    try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

@niels9001 niels9001 enabled auto-merge (squash) May 21, 2026 21:18
@niels9001 niels9001 merged commit 386fdcb into main May 22, 2026
17 checks passed
@niels9001 niels9001 deleted the copilot/fix-number-not-showing-in-shortcut-guide branch May 22, 2026 03:08
@LegendaryBlair LegendaryBlair added the Product-Shortcut Guide Refers to the Shortcut Guide PowerToy label May 22, 2026
@LegendaryBlair LegendaryBlair added this to the PowerToys 0.100 milestone May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

0.100 Product-Shortcut Guide Refers to the Shortcut Guide PowerToy

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Shortcut Guide] Number not showing in shortcut guide key

5 participants