GUI: Adds clear and cls alias for gui console debugger

This commit is contained in:
Ralph Caraveo 2023-10-04 13:34:42 -07:00 committed by Filippos Karapetis
parent 0396a08b42
commit f720fba1aa
4 changed files with 23 additions and 0 deletions

View File

@ -133,6 +133,18 @@ void ConsoleDialog::resetPrompt() {
_prompt = PROMPT;
}
void ConsoleDialog::clearBuffer() {
// Reset the line buffer.
memset(_buffer, ' ', kBufferSize);
// Along with a few key vars.
_currentPos = 0;
_scrollLine = _linesPerPage - 1;
_firstLineInBuffer = 0;
updateScrollBuffer();
}
void ConsoleDialog::slideUpAndClose() {
if (_slideMode == kNoSlideMode) {
_slideTime = g_system->getMillis();

View File

@ -165,6 +165,7 @@ public:
void setPrompt(Common::String prompt);
void resetPrompt();
void clearBuffer();
protected:
inline char &buffer(int idx) {

View File

@ -73,6 +73,8 @@ Debugger::Debugger() {
registerCmd("md5", WRAP_METHOD(Debugger, cmdMd5));
registerCmd("md5mac", WRAP_METHOD(Debugger, cmdMd5Mac));
#endif
registerCmd("clear", WRAP_METHOD(Debugger, cmdClearLog));
registerCmd("cls", WRAP_METHOD(Debugger, cmdClearLog)); // alias
registerCmd("exec", WRAP_METHOD(Debugger, cmdExecFile));
registerCmd("debuglevel", WRAP_METHOD(Debugger, cmdDebugLevel));
@ -808,6 +810,13 @@ bool Debugger::cmdDebugFlagEnable(int argc, const char **argv) {
return true;
}
bool Debugger::cmdClearLog(int argc, const char **argv) {
#ifndef USE_TEXT_CONSOLE_FOR_DEBUGGER
_debuggerDialog->clearBuffer();
#endif
return true;
}
bool Debugger::cmdExecFile(int argc, const char **argv) {
if (argc <= 1) {
debugPrintf("Expected to get the file with debug commands\n");

View File

@ -275,6 +275,7 @@ protected:
bool cmdDebugFlagsList(int argc, const char **argv);
bool cmdDebugFlagEnable(int argc, const char **argv);
bool cmdDebugFlagDisable(int argc, const char **argv);
bool cmdClearLog(int argc, const char **argv);
bool cmdExecFile(int argc, const char **argv);
#ifndef USE_TEXT_CONSOLE_FOR_DEBUGGER