Check EnableHexNumpad before enabling it (#17954)

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 ∞ 
This commit is contained in:
Leonard Hecker 2024-09-24 20:56:30 +02:00 committed by GitHub
parent a7e47b711a
commit b520da26d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1631,12 +1631,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)
{