Skip to content
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

Enable ANSI escape code processing on Windows 10 and later #44118

Merged

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Dec 5, 2020

master version of #66216.

This lets the engine and projects use the same color codes in the terminal on all platforms. This includes support for print_rich() (GDScript) and print_line_rich() (C++).

This PR will be needed by #33505 and #36252.

TODO

  • Test on Windows 7/8.1 and see how the fallback behavior works.
    • Tested on Windows 7; ANSI escape codes are printed as-is. Since Windows versions older than 10 are now EOL, this is probably acceptable, but feel free to improve on this in a future PR (e.g. by stripping ANSI escape codes).

@Anutrix
Copy link
Contributor

Anutrix commented Jun 29, 2022

Any reason this is still in draft? Been waiting for this.

@Calinou
Copy link
Member Author

Calinou commented Jun 29, 2022

Any reason this is still in draft? Been waiting for this.

I've been trying to test this on Windows 7/8/8.1 to see how it behaves there. I don't have real hardware running Windows < 10 anymore, so I need to spin up a VM and figure out how to get a software Vulkan implementation running. I've run into some trouble doing this, as Godot won't even start if Vulkan DLLs are not installed (even with --rendering-driver opengl3).

This will surely require adding fallback code to prevent crashing on Windows versions older than 10. We don't expect colored console printing to actually work on Windows versions older than 10, but we should at least make the engine able to run. Bogus ANSI escape codes will likely be present at first, but we can look into stripping ANSI escape codes on old Windows versions if there's enough demand.

If you do have access to a Windows 7/8/8.1 machine, please test this PR locally 🙂

Edit: Windows 64-bit editor binary for testing: https://0x0.st/oSUb.zip (link expires in March 2023)

@Calinou Calinou closed this Jun 29, 2022
@Calinou Calinou reopened this Jun 29, 2022
@Calinou Calinou force-pushed the windows-enable-ansi-escape-codes branch from 86ff18d to 6288be0 Compare June 29, 2022 15:26
@reduz
Copy link
Member

reduz commented Jul 29, 2022

If this works on Windows 10 it shoudl be fine. We should not bother with unsupported versions of Windows.

@Calinou Calinou force-pushed the windows-enable-ansi-escape-codes branch 2 times, most recently from 2af7966 to 84e1598 Compare August 9, 2022 22:50
@Calinou Calinou changed the title Enable ANSI escape code processing on Windows 10 Enable ANSI escape code processing on Windows 10 and later Aug 9, 2022
@Calinou Calinou force-pushed the windows-enable-ansi-escape-codes branch from 84e1598 to 94fb63c Compare August 9, 2022 22:51
@Calinou Calinou marked this pull request as ready for review August 9, 2022 22:52
@Calinou Calinou requested a review from a team as a code owner August 9, 2022 22:52
@Calinou
Copy link
Member Author

Calinou commented Aug 9, 2022

I tested this on Windows 10 and 7 again. It works as expected on both platforms (colored output on Windows 10, no colors on Windows 7).

This lets the engine and projects use the same color codes
in the terminal on all platforms. This includes support for
`print_rich()` (GDScript) and `print_line_rich()` (C++).
@Calinou Calinou force-pushed the windows-enable-ansi-escape-codes branch from 94fb63c to debfc7c Compare August 9, 2022 22:53
@akien-mga akien-mga requested a review from bruvzg August 9, 2022 22:56
@YuriSizov
Copy link
Contributor

Paging @bruvzg if you want to look into this.

@YuriSizov YuriSizov merged commit d2a6a18 into godotengine:master Sep 8, 2022
@YuriSizov
Copy link
Contributor

Thanks!

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.

5 participants