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

Mouse codes are printed to the terminal on exit #82

Closed
willmcgugan opened this issue Sep 4, 2021 · 5 comments
Closed

Mouse codes are printed to the terminal on exit #82

willmcgugan opened this issue Sep 4, 2021 · 5 comments
Labels
help wanted Extra attention is needed level:moderate A task require a bit of thought

Comments

@willmcgugan
Copy link
Collaborator

Sometimes mouse codes are printed to the terminal on exit. This tends to occur if you are moving the mouse around then exit quickly.

I suspect this is because the app exists prior to all mouse events in stdin being consumed.

Find a way to a) reliably reproduce this error and b) fix it.

I suspect this will require disabling input then posting a null event and waiting for that event to be processed, prior to exiting.

@willmcgugan willmcgugan added help wanted Extra attention is needed level:easy An easy task level:moderate A task require a bit of thought and removed level:easy An easy task labels Sep 4, 2021
@lllama
Copy link
Contributor

lllama commented Sep 15, 2021

I wonder whether PyAutoGUI could be used as part of this? Have a test wiggle the mouse and then ctrl-c the app? Though then you'd have to spawn the app somewhere and then run the test in a separate process/window/etc

@AcousticCh
Copy link

My programing skills are not intermediate yet but I am a daily linux user. I'd like to try my hand at this, after recreation of the issue I would attempt to turn the unwanted mouse output into a daemon with the subprocess module

@lllama
Copy link
Contributor

lllama commented Oct 3, 2021

My thinking is that this would require a shutdown routine for the event loop. In that routine we would use termios.tcflush() or similar to flush stdin before we exit. For Windows we would need to use mscrt to read keys - not sure if that will translate to mouse events though.

@willmcgugan
Copy link
Collaborator Author

Should be fixed in 0.1.13

@github-actions
Copy link

github-actions bot commented Jan 1, 2022

Did I solve your problem?

Consider sponsoring my work on Textual with a monthly donation.

Or buy me a coffee to say thanks.

Will McGugan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed level:moderate A task require a bit of thought
Projects
None yet
Development

No branches or pull requests

3 participants