asweigart / bext

A cross-platform Python 2/3 module for colorful, text-based terminal programs.
Other
18 stars 2 forks source link

Can't detect arrow keys in CMD/Windows Terminal #4

Open teverus opened 2 years ago

teverus commented 2 years ago

Hi! :) First of all, thanks for the wonderful app!

I have encountered this issue: when I run a script on Windows in CMD or Windows terminal and getKey any of the arrows, the following happens: any arrow is rendered as "a". However, when I run the same code in my IDE, I get '\xe0K', '\xe0M' and so on.

As far as I can see, the problem is that when you try to get key in the native environment, you get "àK", and not "\xe0K".

Any idea how we can fix that? :)

UPD: I've just tested: the "a" that I get in the console is not real "a". Therefore, my theory about "àK" may be onto something...

UPD2: This seems to be the inherited problem of the msvcrt module :(