Testing code and showcase for PyCharm terminal emulation issue at https://youtrack.jetbrains.com/issue/PY-59857/Debug-Terminal-Emulator-Input
The library used for the key reading is https://github.com/magmax/python-readchar, but previously it was also attempted with quite similar custom code, the library is very wide realistic to historical needs and updated so there is no need to custom simulate it
The explanation for each scenario is explained inside the 1_emulate_terminal_in_out_console.py
and
in 2_run_with_python_console-py
with comments with the expected outcomes
Clone the project with git
git clone https://github.com/OriDevTeam/terminal-input-test.git
To setup the environment and install packages with Poetry
poetry install
To setup just the single dependency globabally with Pip
pip install readchar
To reproduce simply select the 1_emulate_terminal_in_output_console
configuration in Run or Debug
If they are missing or you want to make sure they are as intended, select the 1_emulate_terminal_in_output_console.py
file and edit its configuration, and check the Emulation > Emulate terminal in output console
box