-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Dvorak: Ctrl+] may not work correctly over the PTY #4885
Comments
I suspect you're using a German keyboard (or at least something different from a typical US layout), and the Windows Terminal key handling just doesn't deal with that very well. You may find you can get the equivalent of Ctrl+] by using Ctrl++ (or whatever key is just to the left of your Return key). Not that I'm suggesting that's a real solution to the problem, but it may help you get by in the meantime. I think there is probably an existing issue for this somewhere. Not necessarily the same key combo or language, but I'm guessing these bugs all have the same root cause. |
@j4james you're right, I use US Dvorak layout and when I switch it to US English the keys start working. However, I didn't find an alternate combination that works in Dvorak mode, and switching keyboard layouts each time is a little inconvenient… ;) |
Puzzlingly, I can't even get putty to work right with a German keyboard layout. I'm pressing LCtrl+AltGr+9 and just getting |
(I also tried RCtrl, just to make sure I wasn't messing up AltGr) |
@DHowett-MSFT as far as I recall, it was never possible to exit telnet on Windows with a German keyboard layout. This is due to the problem that Ctrl + Alt is an alternative combination to AltGr, possibly for keyboards lacking the latter. According to rumours, Ctrl + + is supposed to work for telnet. On the Dvorak layout, however, ] is an unshifted, unmodified key just like on the standard US layout, if in a different position. That's why I'm surprised that it also causes problems. |
So, here's something I just realized: the pseudoconsole does key-to-event translation based entirely on the main system keyboard (not the active one!). I'm not sure how we can do translation based on the active one. Is dvorak your primary or secondary? |
(When I say I'm not sure how we can, I mean "how we can contribute that information to a pseudoconsole session, because it could be on a remote system for all we know) |
@DHowett-MSFT interesting question: it was in fact my secondary layout, so I removed the standard US layout and made Dvorak my only layout – the problem remains! Neither Ctrl+] nor Ctrl+= or Ctrl+- (keys to the left to enter) have the effect expected for Ctrl+]. As mentioned above, when I switch to standard US layout, I can use Ctrl+] normally. As for your concern about input from a remote system: from my understanding of the ConPTY architecture, this really shouldn't matter. All that's transmitted to and from ConPTY, whether over the network or locally, is UTF-8 encoded »text/VT« and therefore keyboard layout agnostic. It's the terminal app's job (on the left in the linked illustration) to convert INPUT_RECORD, KEY_EVENT_RECORD and whatnot to »text/VT« and send it to its PTY, and it should naturally use the user's currently active keyboard layout of the machine on which the terminal app is running (ignoring cases like RDP, for the moment). If the other end of the PTY (locally or remotely, on the right in the linked illustration) is connected to a legacy ConDrv app, the ConHost on that side needs to translate »text/VT« back to INPUT_RECORD, KEY_EVENT_RECORD &c. In my opinion, it should reasonably assume that the legacy app is going to interpret those events based on the active keyboard layout on its machine. This is especially true since by design a legacy app has no knowledge that its input came through a PTY. But that issue is between ConHost and the legacy app, meaning that the terminal app doesn't need to concern itself with – if fact it can't, because the other side of its PTY could be connected to a non-Windows system for all it knows, where the concept of Windows keyboard layouts doesn't apply. |
Frg tbr, ,dayw C |
As you can likely tell, I've been installing different keyboard layouts. Okay, with that out of the way... I bet, or at least hope quite a bit, that this is working for you with Terminal v0.10. I kept trying to reproduce the issue, and I just kept coming up blank. We made some changes to ConPTY in v0.10 so that input sent into the pty gets passed through directly to the client application (as it should be!) without translation when the receiving application is expecting VT input. |
You're right about our architecture, though: the onus of translating
(0.10 is more direct)
I can't get the issue to repro even in a case that does require back-translation, though, with either the old version of the PTY or the console host itself in VT input mode even with Dvorak as my primary. That's curious. If it still reproduces for you, can you run Thanks. |
@DHowett-MSFT in the meantime, my Windows Terminal has updated itself to 0.10.781.0.
However, I can't manage to get any output for Ctrl+- and Ctrl+=, even if I set their With a US Dvorak layout, none of Ctrl+[, Ctrl+], Ctrl+Shift+6 produce any output from Please let me know if there is any more testing I can do to help. Note: while playing around with |
I'm willing to bet that this was fixed with #4192, but I'll leave it open and assigned to me, off the triage queue, until we can confirm (once 0.11 is out) |
@DHowett-MSFT wow, that looks like a substantial refactoring – any timeline for 0.11? |
"Soon." If you're willing to test out a preflight build, would you mind e-mailing me (address is in my profile)? I'd love to see if this helps. |
(It'll be code-signed by Microsoft, no funny business here 😁) |
@DHowett-MSFT Hi Dustin, I ran a build and made it contained the changes from #4192. Sadly, I must report that the behaviour I described above is unchanged – meaning I don't get any output from I guess now that I have the source code I could just put a breakpoint in and start debugging. Alas, today I'm too busy with other stuff. But if you have some specific question I'm happy to give it a shot! PS: I was very impressed how easy it was to set up the build – kudos, most builds I've seen have been much more effort to get running ;-) |
Really sorry it didn't work out! I'm glad it was easy to build, however. I'd be very interested to see what's coming in on TermControl.cpp's _KeyDownHandler and _CharacterHandler... If you have a debug build going, you can hold down both alt keys when clicking on a profile menu item to get a tap that will show, in red, any user input. That'll help us determine, at least, if it's making it out of Terminal alright. :) |
Hi Dustin, no need to be sorry, it was worth a shot! I'm currently at ea1bb2e. I activated the »raw« window and with Dvorak layout active, there is no red output (there is with US layout). These are the results of breakpoints at the call to
The call to Here's the same for Dvorak layout:
Most notably, there is no call to Other than that, everything in I don't have time now to trace where the call to |
It's really quite strange that |
So, here's a question... You've got a tool called Spy++, which came with Visual Studio. My copy is at Can you launch it, and use the Find tool to find a Terminal window? Drag the crosshairs in the dialog over the edges of the terminal window until you find the CASCADIA_HOSTING_WINDOW_CLASS: Click [OK], and it should open up that window in the tree view. and choose "Messages". Then, go and press one of
the WM_CHAR there in the middle is win32/win32k generating the thing that should trigger "CharacterHandler" down in Xaml land. This is the earliest possible place we could see this message getting generated. |
Oh: to get the log out of the messages window I had to go to the Messages menu and choose "save log file" |
@DHowett-MSFT Hi Dustin, here are the Sky++ key logs: I verified I get the same as you with a US layout. With Dvorak, it's the same keys ( Ctrl+[
Ctrl+]
Ctrl+Shift+6
I have to add that in regular console windows, these key combinations do work, even though they also don't get a Out of curiosity, I tried the keys without modifier and then they do generate
]
|
@DHowett-MSFT Hi Dustin, the above investigation into As it turns out, the Windows keyboard system generates control character What made it confusing was that these key combinations do work in the normal Windows console. Since it also doesn't get any TL;DR Thanks for your patience and help, if you have any more questions or debugging requests I'll be happy to respond. |
Wow! Thanks so much for digging in. Which DVORAK layout have you been using? I was testing with the one that ships inbox with Windows ... 😉 |
To be honest, it only dawned on me after sleeping over the missing |
Huh! That makes sense. Thanks again -- this has been enlightening (and perhaps is worthy of a feature request to the input folks to improve the inbox Dvorak layout ... I'll follow up with that 😄) |
Environment
Steps to reproduce
Start a Linux shell in Terminal using the default profile (»Ubuntu«). Open vi and type »:help help«. This opens a help window. Within the help window, move the cursor over one of the green words, such as »helplang« and press Ctrl-].
Expected behavior
The help window should update to show the help text for »helplang«. The Ctrl-] shortcut is used in vi to navigate to »tags« – these can be program code (created using ctags) or hyperlinks in the help system.
Actual behavior
The shortcut is ignored. Nothing happens. Unbinding
ctrl+]
does not help. There does not appear to be a way to navigate to tags in vi in Terminal.If you followed the steps to reproduce you're going to need this.
The text was updated successfully, but these errors were encountered: