Skip to content

Restore clear command for the client console#5029

Open
HeresHavi wants to merge 2 commits into
multitheftauto:masterfrom
HeresHavi:console-clear-command
Open

Restore clear command for the client console#5029
HeresHavi wants to merge 2 commits into
multitheftauto:masterfrom
HeresHavi:console-clear-command

Conversation

@HeresHavi

@HeresHavi HeresHavi commented Jul 11, 2026

Copy link
Copy Markdown

Summary

Added a built-in clearconsole command for the F8 console.

It clears visible and queued output while keeping command history and console.log intact. It can also be used as /clearconsole in the chat.

Motivation

MTA already had code for clearing the console, but the original command was disabled because the old GUI implementation could crash when clearing multiple lines. That problem could not be reproduced with the current console, including with large amounts of output and new lines being added continuously.

The restored implementation also clears output waiting to be displayed, preventing old lines from reappearing when the console is reopened.

For example, a developer debugging a busy resource may build up thousands of lines in the F8 console. They can now clear the visible output without losing their previous commands or the persistent log.

Test plan

Runtime

  • Before Fix: The client had no registered command for clearing the F8 console.
  • After Fix: Filled the console with multiline output, ran clearconsole, and confirmed all visible and queued output was removed.
  • Valid Case: New output continued appearing normally after clearing, and Up Arrow command history still worked.
  • Repeated Use: Cleared an empty console, cleared repeatedly while a timer added output, and cleared after generating a 6000-character line.
  • No crashes, freezes, or broken console states occurred.

Builds and Tests

  • Debug | Win32: Client Core build passed.
  • Release | Win32: Full solution build passed.
  • Client tests: 304 tests passed.
  • Ran clang-format.

Checklist

  • Your code should follow the coding guidelines.
  • Smaller pull requests are easier to review. If your pull request is beefy, your pull request should be reviewable commit-by-commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant