-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Incorrect Handling of Arrow Keys in miniterm.py #174
Comments
I can confirm this experience on Lubuntu Trusty with the latest pyserial and miniterm available from pip also when accessing the Micropython REPL, by invoking...
A character appears to be swallowed, which massively confuses the logic of the REPL (when using the up-arrow-history to retrieve a command, it executes the neighbouring line, not the one shown). The same REPL interface is functional without errors when invoking screen like... screen /dev/ttyUSB0 115200 |
In debug mode, invoked on my machine by...
I noted that the first time you begin to press the arrow key it appears to generate just... [TX:u'\x1b'] ...while subsequent times, pressing the arrow key generates the following three events... [TX:u'['] [TX:u'A'] [TX:u'\x1b'] Don't know if this is relevant somehow. I am running within LXTerm where |
I can confirm this on OSX 10.11.6 using python3.5.1 and pyserial3.2.1 |
I can confirm from my testing that the new version has removed the problem for OS X, (and probably similar terminal environments such as an Ubuntu xterm session) such that the following invocation on my machine creates a fully-functional interactive terminal session over serial with a NodeMCUv2 running Micropython 1.8.6 ...
|
Great - the new version fixes the bug. According to my own testing it initially was a problem between the blocking select.select statement and incremental decoding of the input stream. The select statement blocked before all decoding was done. But that is history now... |
the way select was used, was incompatible with the text io wrapper used by python3 for sys.stdin
I stumpled upon this bug when tracing down a problem in mpfshell - a shell for micropython [1].
There the problem came up that the arrrow keys show a lagging behaviour when navigating the shell history or the command line.
Basically you press ARROW-UP, nothing happens, you press ARROW-UP again and get the arrow-up functionality once [2]. This, of course, renders the REPL of micropython pretty useless...
To find out what is received and sent by miniterm I added two lines of debugging code:
This made clear that there is at least a bug in the getkey function (and probably in the encoding function)..
After the first keypress you get
After the next single keypress you get
Here getkey keeps kind of lagging behind. And I'm not sure about the correctness of the encoding...
The problem seems to be limited to Linux and Python 3.x. I've done the testing with Kubuntu 16.04-64,
Python 3.5.2 and pyserial 3.2.1.
GHPS
[1] https://github.com/wendlers/mpfshell
[2] wendlers/mpfshell#11
The text was updated successfully, but these errors were encountered: