Skip to content
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

Harden EscSeqUtils #2803

Open
tig opened this issue Aug 11, 2023 · 2 comments · May be fixed by #3837
Open

Harden EscSeqUtils #2803

tig opened this issue Aug 11, 2023 · 2 comments · May be fixed by #3837
Assignees
Labels
Milestone

Comments

@tig
Copy link
Collaborator

tig commented Aug 11, 2023

NetDriver in v2 has bad keyboard behavior because of this.

There is a bug somewhere that is causing isEscSeq to be true with cki 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.

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.

Originally posted by @tig in #2745 (comment)

@tig tig added the bug label Aug 12, 2023
@tig tig moved this to 🔖 Ready in Terminal.Gui V2 Beta Aug 12, 2023
@BDisp
Copy link
Collaborator

BDisp commented Aug 22, 2023

Time to times I'm getting this error and the escape sequences always start with \u001b[04; and aleatory number at the end. I think this related with some color escape sequence that Console is reading while the mouse is moving. @tig are you sure you are sending escape sequences for colors at once and not waiting for some condition that will cause they are incomplete?

imagem

imagem

@BDisp
Copy link
Collaborator

BDisp commented Aug 22, 2023

This mainly happens on opening a scenario because they are always running Init and Shutdown and although the Application doing a disposing of public variables there are threads that are being executed on others objects, like NetEvents. On ResetState it call MainLoop?.Stop() which only set _running = false and call MainLoopDriver.Wakeup () that only wake if it's hang to force an iteration. While the IMainLoopDriver doesn't have a End as the ConsoleDriver have, it isn't possible to dispose any thread object to avoid propagating events for the new app that belong to the latest closed. For now it can be done through the ConsoleDriver by accessing the mainloop.

BDisp added a commit to BDisp/Terminal.Gui that referenced this issue Aug 22, 2023
tig added a commit that referenced this issue Aug 30, 2023
@tig tig moved this from 🔖 Ready to 🆕 Not Triaged in Terminal.Gui V2 Beta May 13, 2024
@tig tig added this to the v2 Release milestone Jul 11, 2024
@tig tig self-assigned this Aug 14, 2024
@tig tig moved this to 🏗 Approved - In progress in Terminal.Gui V2 Initial Release Aug 14, 2024
@tig tig linked a pull request Nov 23, 2024 that will close this issue
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 🏗 Approved - In progress
Status: 🆕 Not Triaged
Development

Successfully merging a pull request may close this issue.

2 participants