[PR #2067] [MERGED] Allow the mapping of OEM keys ({}|\<>/_-=+) in key bindings #24785

Open
opened 2026-01-31 09:05:20 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/2067
Author: @DHowett-MSFT
Created: 7/23/2019
Status: Merged
Merged: 7/23/2019
Merged by: @DHowett-MSFT

Base: masterHead: dev/duhowett/oemvk


📝 Commits (2)

  • 5531286 Allow the mapping of OEM keys ({}|<>/_-=+) in key bindings
  • 8bb5332 Update src/cascadia/TerminalApp/App.cpp

📊 Changes

4 files changed (+65 additions, -45 deletions)

View changed files

📝 src/cascadia/TerminalApp/App.cpp (+35 -2)
📝 src/cascadia/TerminalApp/AppKeyBindings.cpp (+0 -27)
📝 src/cascadia/TerminalApp/AppKeyBindings.h (+0 -1)
📝 src/cascadia/TerminalApp/KeyChordSerialization.cpp (+30 -15)

📄 Description

This commit introduces support for key bindings containing keys
traditionally classified as "OEM" keys. It uses VkKeyScanW and
MapVirtualKeyW, and translates the modifiers that come out of
VkKeyScanW to key chord modifiers.

The net result of this is that you can use bindings like "ctrl+|" in
your settings. That one in particular will be reserialized (and
displayed in any menus) as "ctrl+shift+". Admittedly, this is not
clear, but it is the truest representation of the key.

This commit also moves the Xaml key chord name override generator into
App as a static function, AND it forces its use for all modifier
names. This will present a localization issue, which will be helped in
part by #1972. This is required to work around
microsoft/microsoft-ui-xaml#708. I've kept the original code around
guarded by a puzzling ifdef, because it absolutely has value.

Fixes #1212.

image

Renormalization

input reserialized as
"alt+=" "alt+plus"
"alt+:" "alt+shift+;"
"ctrl+?" "ctrl+shift+/"
"shift+~" "shift+<backtick>"
(markdown limitation)
"alt+}" "alt+shift+]"
"ctrl+alt+<pipe>" "ctrl+alt+shift+\\"
"shift+\"" "shift+'"
"alt+," "alt+,"
"ctrl+-" "ctrl+-"
"shift+." "shift+."

PR Checklist

Validation Steps Performed

Manual


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/2067 **Author:** [@DHowett-MSFT](https://github.com/DHowett-MSFT) **Created:** 7/23/2019 **Status:** ✅ Merged **Merged:** 7/23/2019 **Merged by:** [@DHowett-MSFT](https://github.com/DHowett-MSFT) **Base:** `master` ← **Head:** `dev/duhowett/oemvk` --- ### 📝 Commits (2) - [`5531286`](https://github.com/microsoft/terminal/commit/5531286b85ba8ed21fefba559dbd2acc4008f9af) Allow the mapping of OEM keys ({}|\<>/_-=+) in key bindings - [`8bb5332`](https://github.com/microsoft/terminal/commit/8bb5332578d92cd0389276c1746d61ab1361911c) Update src/cascadia/TerminalApp/App.cpp ### 📊 Changes **4 files changed** (+65 additions, -45 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalApp/App.cpp` (+35 -2) 📝 `src/cascadia/TerminalApp/AppKeyBindings.cpp` (+0 -27) 📝 `src/cascadia/TerminalApp/AppKeyBindings.h` (+0 -1) 📝 `src/cascadia/TerminalApp/KeyChordSerialization.cpp` (+30 -15) </details> ### 📄 Description This commit introduces support for key bindings containing keys traditionally classified as "OEM" keys. It uses VkKeyScanW and MapVirtualKeyW, and translates the modifiers that come out of VkKeyScanW to key chord modifiers. The net result of this is that you can use bindings like "ctrl+|" in your settings. That one in particular will be reserialized (and displayed in any menus) as "ctrl+shift+\". Admittedly, this is not clear, but it _is_ the truest representation of the key. This commit also moves the Xaml key chord name override generator into App as a static function, *AND* it forces its use for all modifier names. This will present a localization issue, which will be helped in part by #1972. This is required to work around microsoft/microsoft-ui-xaml#708. I've kept the original code around guarded by a puzzling ifdef, because it absolutely has value. Fixes #1212. ![image](https://user-images.githubusercontent.com/14316954/61683890-22489a00-accc-11e9-8fa2-88869043ac4a.png) ### Renormalization | input | reserialized as | |-|-| | `"alt+="` | `"alt+plus"` | | `"alt+:"` | `"alt+shift+;"` | | `"ctrl+?"` | `"ctrl+shift+/"` | | `"shift+~"` | `"shift+<backtick>"`<br>_(markdown limitation)_ | | `"alt+}"` | `"alt+shift+]"` | | `"ctrl+alt+<pipe>"` | `"ctrl+alt+shift+\\"` | | `"shift+\""` | `"shift+'"` | | `"alt+,"` | `"alt+,"` | | `"ctrl+-"` | `"ctrl+-"` | | `"shift+."` | `"shift+."` | <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [x] Closes #1212 * [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [x] I've discussed this with core contributors already. ## Validation Steps Performed Manual --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:05:20 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#24785