getting a KEY_ESC event when resizing pycharm terminal
See original GitHub issuewidnows 10, asciimatics 1.13.0, python 3.9.5
I am running Screen.wrapper in pycharm (either by using Emulate terminal option OR by using the terminal tab and running python.exe). After resizeing the terminal window a few times, i get a KEY_ESC keyboard event. that is a KeyboardEvent event with key_code=-1. I am not sure if this is a pycharm or asciimatics issue, however i was not able to get such an escape key event on resize when not using asciimatics.
debugging further i added in screen.py:
event = self._stdin.ReadConsoleInput(1)[0]
if event.EventType == win32console.KEY_EVENT:
print(ord(event.Char)) ### added for dubug
add i am seeing 13 followed by 27 on these resizes. however if i just run input() in the terminal i do not seem to get such key events.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
How do I change the size of the embedded terminal with the ...
Hello,. I'm using the embedded terminal in Pycharm quite a lot. I use ALT+F12 to switch between my code tab and the terminal....
Read more >Python Curses Handling Window (Terminal) Resize
Terminal resize event will result in the curses.KEY_RESIZE key code. Therefore you can handle terminal resize as part of a standard main ...
Read more >Troubleshooting — asciimatics 1.14.0 documentation
These will not be invoked by asciimatics on a resize event. ... Although it is possible to get Linux terminals to report all...
Read more >How To Resize A Window Dynamically - Python Tkinter GUI ...
In this video I'll show you how to resize a window dynamically with Tkinter and Python!We already know how to change the default...
Read more >Image Processing in Python with Pillow - Auth0
Another significant difference between the resize() and ... you might get an error message in your Terminal reading ERROR: Failed building ...
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 Free
Top 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
Good point. That belongs in the troubleshooting docs.
Was intrigued to know why this happened, so dug a little more… PyCharm uses pty4j, which uses winpty tocreate the console window (i.e. terminal in PyCharm). That last package does various things to manipulate the console.
In particular, it has this code to freeze/unfreeze the console output (https://github.com/rprichard/winpty/blob/7e59fe2d09adf0fa2aa606492e7ca98efbc5184e/src/agent/Win32Console.cc#L91). Call me suspicious, but that is injecting an escape key into the Window… which asciimatics then detects.
Definitely an interop issue with that package, so I’m going to close this now.