Skip to content

Add vt100 support to windows port. #6058

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

rockindy
Copy link
Contributor

This patch let terminal output of windows port can be the same as unix port, so we can use the same logic to interact with them, for example, embedded them in cross-platform gui.

Note that windows console doesn't support vt100 control sequence, normally you don't want to enable vt100 support unless you redirect stdin/stdout to another program.

@stinos
Copy link
Contributor

stinos commented May 20, 2020

Can you give a practical example of what this changes?

@robert-hh
Copy link
Contributor

With Windows 10 you can enable vt100 support of the console. See: https://stackoverflow.com/questions/51680709/colored-text-output-in-powershell-console-using-ansi-vt100-codes

@rockindy
Copy link
Contributor Author

#define MICROPY_HAL_HAS_VT100 (0)
micropython uses windows Console API to handle key events like arrow keys and change cursor position. Can't read input from redirected stdin.

#define MICROPY_HAL_HAS_VT100 (1)
micropython set ENABLE_VIRTUAL_TERMINAL_INPUT flag to console mode so it can handle key events by ASCII control sequence. The cursor position is handled by outputting ASCII control sequence. Can read input from redirected stdin.

tannewt pushed a commit to tannewt/circuitpython that referenced this pull request Feb 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants