prompt-toolkit / python-prompt-toolkit

Library for building powerful interactive command line applications in Python
https://python-prompt-toolkit.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
9.1k stars 717 forks source link

Arrow keys not working in windows 'Terminal' #1789

Open EvanTheB opened 9 months ago

EvanTheB commented 9 months ago

This script:

from prompt_toolkit.shortcuts import radiolist_dialog

radiolist_dialog(
    values=[(i, str(i)) for i in range(5)],
).run()

Runs well in a WSL session running in the 'Windows console Host' terminal. However the same program running in the 'Windows Terminal' terminal does not accept arrow key inputs. The mouse does work in both environments, as does the tab key and normal typing.

You can choose which terminal WSL opens with by searching 'Terminal' in your settings and overriding 'Let windows decide'.

running showkey and pressing arrow buttons gives me identical results for both environments, so I'm not sure what is causing this:

> showkey
^[[A^[[C^[[D^[[B
EvanTheB commented 8 months ago

Aha, the arrow keys are being registered, the highlight is just not displaying. On the working terminals I see a blinking _ shape, on windows Terminal I see nothing, any suggestions ?