-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
Option/command to clear system console #28632
Comments
Printing stuff on the same line is usually accomplished (under linux at least) via |
This is a lot more complex than you would imagine, there are many different terminals and OSes and there is no builtin C/C++ system to clear their output. To achieve this, Godot would have to be turned into a terminal-aware application binding to libraries such as ncurses or terminfo, just for this small facility. Instead, I'd suggest that someone makes a plugin for the asset library that can call |
This can be done in GDScript using ANSI escape codes: var escape := PoolByteArray([0x1b]).get_string_from_ascii()
print(escape + "[2J" + escape + "[;H" + "This text will be printed at the top.") However, this won't work on Windows (until we declare Godot to be ANSI code-compatible on Windows 10), and it won't impact the editor's Output tab (which will print |
Feature and improvement proposals for the Godot Engine are now being discussed and reviewed in a dedicated Godot Improvement Proposals (GIP) (godotengine/godot-proposals) issue tracker. The GIP tracker has a detailed issue template designed so that proposals include all the relevant information to start a productive discussion and help the community assess the validity of the proposal for the engine. The main (godotengine/godot) tracker is now solely dedicated to bug reports and Pull Requests, enabling contributors to have a better focus on bug fixing work. Therefore, we are now closing all older feature proposals on the main issue tracker. If you are interested in this feature proposal, please open a new proposal on the GIP tracker following the given issue template (after checking that it doesn't exist already). Be sure to reference this closed issue if it includes any relevant discussion (which you are also encouraged to summarize in the new proposal). Thanks in advance! |
On Windows, you can set the terminal to interpret ANSI by opening regedit and adding a "VirtualTerminalLevel" DWORD with a value of 1 under HKEY_CURRENT_USER\Console |
See also #44118 which will enable ANSI code processing by default on Windows 10. |
This is terrible advice. I tried this and now every version of GODOT that I try to run has a non-functional Print function. Please do not edit the registry for any reason unless required. |
See also #44118, which would enable Windows support for using ANSI escape codes (including the one to clear the console). #44118 doesn't fallback for Windows versions older than 10 yet, but if you only need to support Windows 10 and later, you could cherry-pick it and build the engine and Windows export templates from source. |
Sorry if this is stupid, I have no clue how to expose a method in GDScript. Line 199 in f6a78f8
|
This method could be exposed to editor plugins, but it only clears the editor Output panel, not terminal console output. |
Could it also be done in a way to make it callable with something simple as |
Please create a GDScript command that will clear the console window. (NOT just the OUTPUT window.)
Preferably something like console.clear().
Also, being able to re-print a line (so you can print "Loading... 5%" then (on the same line:) "Loading... 7%" etc... that would be cool too.
Please consider.
Thanks -
The text was updated successfully, but these errors were encountered: