magmax / python-readchar

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

Fix Enter Key Keycode #61

Closed C0D3D3V closed 2 years ago

C0D3D3V commented 3 years ago

As you can see in this issue (https://github.com/C0D3D3V/Moodle-Downloader-2/issues/83), since reformatting, the enter key recognition no longer works. (You can see my readkey usage here https://github.com/C0D3D3V/Moodle-Downloader-2/blob/284f84614934d6d9ca279ffdec0884d1d0cdb873/moodle_dl/utils/cutie.py#L318)

I hope that was not intentional. There has sneaked in a small change in the reformatting.

C0D3D3V commented 3 years ago

Maybe we don't need to reverse the change after all. But the fact is, in raw mode Enter is read as '\r' and in cbreak mode as '\n'. So the keycodes are not correct anymore.

C0D3D3V commented 3 years ago

I changed the mode back to cbreak and corrected the key codes. I don't know if any other codes are wrong.

This is maybe also not the best solution, because I think on windows the old keycode for enter is still correct.

I have fixed my code with https://github.com/C0D3D3V/Moodle-Downloader-2/commit/bb3c466a5fe9fcc80ade94748112c41d9b3265a2. But it would be nice if you correct the keycodes soon and see if others are wrong (so that they are correct under windows and linux).