-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alt + numpad combination does not work anymore #17327
Comments
Thanks for the report! I suspect this might be related to PR #17067. There are a couple of places in the code that mention Alt-Numpad being handled in terminal/src/cascadia/TerminalApp/TerminalPage.cpp Lines 1439 to 1442 in 5d1cf1a
But /cc @lhecker |
It works in conhost because that one doesn't rely on the WinRT TSF stack via TextInputHost, and so it'll receive the Alt+Numpad key regularly via |
Wow. Just after I wrote that I found that switching my keyboard layout to Korean or any other "complex" language fixes the issue. What in the heck! |
So, with all that said, I think it'd be way easier to just write our own Alt+Numpad support in If anyone wants to give it a shot, please do so! Windows internals for the curious follow below: I spent an unfathomable amount of time debugging this. 😄 I tried solving this issue by adding this to // The remaining callbacks must be implemented because SendInput should only be called if there's no active composition.
const auto manager = Windows::UI::Text::Core::CoreTextServicesManager::GetForCurrentView();
_editContext = manager.CreateEditContext();
_editContext.TextUpdating([this](auto&&, auto&& args) { SendInput(args.Text()); });
_editContext.TextRequested([](auto&&, auto&&) {});
_editContext.SelectionRequested([](auto&&, auto&&) {}); (And We call terminal/src/tsf/Implementation.cpp Line 42 in 13de7c6
It's implemented by (The TSF context is mostly an adapter between the public msctf.h interfaces and the private implementation. We need our own context because we need
HRESULT CInputContext::GetStatus(TS_STATUS* status)
{
YOUR_IMPLEMENTATION->GetStatus(status);
if (YOU_IMPLEMENTED_THE_ITextInputClientOwner_INTERFACE?)
status->dwStaticFlags |= TS_SS_UWPCONTROL;
else
status->dwStaticFlags &= ~TS_SS_UWPCONTROL;
} The existence of this I think that's a bug in the TSF implementation. The lack of Alt+Numpad support is likely a fallout from this, because when that flag is missing and In any case, if I pass any The only problem with all that is that it doesn't solve the focus problem: To make this work we need to give both WinUI's context (for Alt+Numpad) and our context (= our IME) focus at the same, which means that both will receive the same input at the same time. That's really really bad, because TSF3 doesn't use |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as abuse.
This comment was marked as abuse.
This adds an indirection for `_KeyHandler` so that `OnDirectKeyEvent` can call `_KeyHandler`. This allows us to consistently handle Alt-key-up events. Then I added custom handling for Alt+ddd (OEM), Alt+0ddd (ANSI), and Alt+'+'+xxxx (Unicode) sequences, due to the absence of Alt-key events with xaml islands and our TSF control. Closes #17327 ## Validation Steps Performed * Tested it according to https://conemu.github.io/en/AltNumpad.html * Unbind Alt+Space * Run `showkey -a` * Alt+Space generates `^[ ` * F7 generates `^[[18~` (cherry picked from commit 2fab986) Service-Card-Id: PVTI_lADOAF3p4s4AmhmszgSCpCg Service-Version: 1.21
Windows Terminal version
1.21.1272.0
Windows build number
10.0.22631.0
Other Software
wsl terminal, powershell, etc.
Steps to reproduce
Sequential numpad keys combinations with the ALT key pressed to insert special characters ( for example the most common ones such as
{
with ALT+123,~
with ALT+126, or the tilde ~ with ALT+126, etc. ) do not work anymore.The latest working version is Microsoft.WindowsTerminal.Preview 1.20.11215.0, the next current one (1.21.1272.0) broke this functionality.
Expected Behavior
On previous versions the combination works
raksati@wsl:$ showkey -a
Press any keys - Ctrl-D will terminate this program
` 96 0140 0x60
^D 4 0004 0x04
raksati@wsl:~$
Actual Behavior
nothing is detected:
raksati@wsl:$ showkey -a
Press any keys - Ctrl-D will terminate this program
^D 4 0004 0x04
raksati@wsl:~$
The text was updated successfully, but these errors were encountered: