magmax / python-readchar

Python library to read characters and key strokes
MIT License
143 stars 45 forks source link

Read multiple-characters keys only when stdin is not empty #30

Closed MatteoCampinoti94 closed 2 years ago

MatteoCampinoti94 commented 6 years ago

The first character is read normaly, subsequent reads are done with NONBLOCK flag active allowing for special characters 0x1b 0x5b 0x33 to be read alone without having to wait for a second read. This for example allows to use readkey to detect a single press of ESC which would have otherwise not returned anything until a second key was pressed that was different than x05b. With the old behavior presssing ESC and then a cursor key would have returned '0x1b0x1b' leaving two characters still stored in the buffer on top of providing an incorrect read.

Old behavior was conserved to allow for getchar_fn to keep functioning properly

All tests provided were passed

MatteoCampinoti94 commented 6 years ago

requirements.txt is missing thus failing all automated tests on travis-ci. Skipping the pip command allows for proper testing as the makefile works perfectly.

MatteoCampinoti94 commented 6 years ago

It's not just the requirements file missing, the command pip freeze -a fails tooo because -a is not an option. Furthermore python setup.py install doesn't seem to work either in the automated test environment (it works fine with python 3.x on my machine)

Cube707 commented 2 years ago

out of date