`NetDriver` key handling is broken on Windows Terminal v1.18+
See original GitHub issueTo repro simply run UI Catalog and press ESC a few times.
I found this while trying to track down what I broke in #2612.
I kept going back in my commit history to find where the odd behavior I was seeing didn’t happen. I eventually just tried v2_develop and discovered this was happening. So I tried it on develop
too.
Issue Analytics
- State:
- Created 2 months ago
- Comments:9
Top Results From Across the Web
WT Preview 1.18 breaks Terminal.Gui keyboard handling ...
Windows Terminal version 1.18.1462.0 Windows build number 10.0.22631.1972 Other Software ... Gui keyboard handling (NetDriver) #15693.
Read more >Windows Terminal Troubleshooting
This guide addresses some of the common errors and obstacles you may encounter when using Windows Terminal.
Read more >Windows Terminal Preview 1.18 Release
Welcome back to another Windows Terminal release! This release updates Windows Terminal to version 1.17 and includes all of the features ...
Read more >Windows Terminal 1.18 Preview Highlights
In this video, Christopher Nguyen (PM on Windows Terminal) and Carlos Zamora (Software Engineer on Windows Terminal) will highlight some ...
Read more >Tutorial: Enable shell integration in the Windows Terminal
In this tutorial, you learn how to configure your shell to enable shell integration features in the Windows Terminal.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I don’t know the code base, so this is just a wild guess, but the code here looks suspicious:
https://github.com/gui-cs/Terminal.Gui/blob/db78fe28bce10fe6ae5d4c6062e8b4ef07f7b8fa/Terminal.Gui/ConsoleDrivers/NetDriver.cs#L198-L201
If you get into that branch,
cki
is going to be set to null, butisEscSeq
is not reset to false. So the next timeGetConsoleKey
is called, ifconsoleKeyInfo.KeyChar
is Esc again, you’re assumedly going to enter that branch withcki
now being null. From there you callDecodeEscSeq
with null, which in turn callsGetCharArray
with null.At least that’s what it looks like to me.
@BDisp see my latest push to this PR.
There is a bug somewhere that is causing
isEscSeq
to be true withcki
being null. I’ve added a defensive check for this as I’ve not been able to reliably reproduce it in a way that shows me what’s causing it.Note, I discovered something else that indicates EscSeqUtils may need to be refactored.
If the user presses a key while the terminal is sending an esc sequence (e.g. a '[35` mouse move report), that key info is lost. The result of this is no keystrokes can happen while the user is moving the mouse.
As we move to a world where all drivers rely heavily on emitting and receiving escape sequences, we need EscSeqUtils to be very robust and flexible. It works pretty darn good right now (great job!) but it is fragile and brittle. It doesn’t help that the documentation for ANSI sequences and all the implementations are so sketchy.
I still haven’t figured out what I screwed up in #2612 that has broken netdriver in this regard, FWIW.