Skip to content

Commit

Permalink
Check EnableHexNumpad before enabling it (#17954)
Browse files Browse the repository at this point in the history
This just adds a quick registry check for `EnableHexNumpad`.

Depends on #17774
Closes #17762 (again)

## Validation Steps Performed
* Alt + NumpadAdd + 221E doesn't do anything ✅
* Set the `EnableHexNumpad` registry key
* Restart
* Alt + NumpadAdd + 221E inserts ∞ ✅

(cherry picked from commit b520da2)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmszgTQsd8
Service-Version: 1.21
  • Loading branch information
lhecker authored and DHowett committed Sep 24, 2024
1 parent 6b380cb commit 41bb31f
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions src/cascadia/TerminalControl/TermControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1575,12 +1575,29 @@ namespace winrt::Microsoft::Terminal::Control::implementation
{
if (vkey == VK_ADD)
{
// Alt '+' <number> is used to input Unicode code points.
// Every time you press + it resets the entire state
// in the original OS implementation as well.
s.encoding = AltNumpadEncoding::Unicode;
s.accumulator = 0;
s.active = true;
static const auto enabled = []() {
wchar_t buffer[4]{};
DWORD size = sizeof(buffer);
RegGetValueW(
HKEY_CURRENT_USER,
L"Control Panel\\Input Method",
L"EnableHexNumpad",
RRF_RT_REG_SZ,
nullptr,
&buffer[0],
&size);
return size == 4 && memcmp(&buffer[0], L"1", 4) == 0;
}();

if (enabled)
{
// Alt '+' <number> is used to input Unicode code points.
// Every time you press + it resets the entire state
// in the original OS implementation as well.
s.encoding = AltNumpadEncoding::Unicode;
s.accumulator = 0;
s.active = true;
}
}
else if (vkey == VK_NUMPAD0 && s.encoding == AltNumpadEncoding::OEM && s.accumulator == 0)
{
Expand Down

0 comments on commit 41bb31f

Please sign in to comment.