[Scummvm-git-logs] scummvm master -> d008f85d3c88678b82848b3174e8c7fbc38bda22
sev-
noreply at scummvm.org
Sat Feb 4 13:59:50 UTC 2023
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
b97b2b0fe3 GUI: Add possibility to specify Debugger prompt
d008f85d3c DIRECTOR: Override debugger prompt in repl mode
Commit: b97b2b0fe323f2fc77e051cfe60af3a5f605c817
https://github.com/scummvm/scummvm/commit/b97b2b0fe323f2fc77e051cfe60af3a5f605c817
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-02-04T14:58:54+01:00
Commit Message:
GUI: Add possibility to specify Debugger prompt
Changed paths:
gui/console.cpp
gui/console.h
gui/debugger.cpp
gui/debugger.h
diff --git a/gui/console.cpp b/gui/console.cpp
index b03a2a7d93b..61f0d1b8471 100644
--- a/gui/console.cpp
+++ b/gui/console.cpp
@@ -121,6 +121,16 @@ void ConsoleDialog::init() {
_pageWidth = (_w - scrollBarWidth - 2 - _leftPadding - _topPadding - scrollBarWidth) / kConsoleCharWidth;
_linesPerPage = (_h - 2 - _topPadding - _bottomPadding) / kConsoleLineHeight;
_linesInBuffer = kBufferSize / kCharsPerLine;
+
+ resetPrompt();
+}
+
+void ConsoleDialog::setPrompt(Common::String prompt) {
+ _prompt = prompt;
+}
+
+void ConsoleDialog::resetPrompt() {
+ _prompt = PROMPT;
}
void ConsoleDialog::slideUpAndClose() {
@@ -159,7 +169,7 @@ void ConsoleDialog::open() {
if ((_promptStartPos == -1) || (_currentPos > _promptEndPos)) {
// we print a prompt, if this is the first time we are called or if the
// engine wrote onto us since the last call
- print(PROMPT);
+ print(_prompt.c_str());
_promptStartPos = _promptEndPos = _currentPos;
}
@@ -283,7 +293,7 @@ void ConsoleDialog::handleKeyDown(Common::KeyState state) {
keepRunning = (*_callbackProc)(this, userInput.c_str(), _callbackRefCon);
}
- print(PROMPT);
+ print(_prompt.c_str());
_promptStartPos = _promptEndPos = _currentPos;
g_gui.scheduleTopDialogRedraw();
diff --git a/gui/console.h b/gui/console.h
index 01effcfe5e5..97b5ca62271 100644
--- a/gui/console.h
+++ b/gui/console.h
@@ -129,6 +129,8 @@ protected:
void slideUpAndClose();
+ Common::String _prompt;
+
public:
ConsoleDialog(float widthPercent, float heightPercent);
virtual ~ConsoleDialog();
@@ -161,6 +163,9 @@ public:
return _pageWidth;
}
+ void setPrompt(Common::String prompt);
+ void resetPrompt();
+
protected:
inline char &buffer(int idx) {
return _buffer[idx % kBufferSize];
diff --git a/gui/debugger.cpp b/gui/debugger.cpp
index 24d1176e84a..0a89c950ca2 100644
--- a/gui/debugger.cpp
+++ b/gui/debugger.cpp
@@ -92,6 +92,18 @@ void Debugger::clearVars() {
}
+void Debugger::setPrompt(Common::String prompt) {
+#ifndef USE_TEXT_CONSOLE_FOR_DEBUGGER
+ _debuggerDialog->setPrompt(prompt);
+#endif
+}
+
+void Debugger::resetPrompt() {
+#ifndef USE_TEXT_CONSOLE_FOR_DEBUGGER
+ _debuggerDialog->resetPrompt();
+#endif
+}
+
// Initialisation Functions
int Debugger::getCharsPerLine() {
#ifndef USE_TEXT_CONSOLE_FOR_DEBUGGER
diff --git a/gui/debugger.h b/gui/debugger.h
index d06eaf5cea0..24fb705c93c 100644
--- a/gui/debugger.h
+++ b/gui/debugger.h
@@ -168,6 +168,9 @@ protected:
*/
void clearVars();
+ void setPrompt(Common::String prompt);
+ void resetPrompt();
+
private:
/**
* The frame countdown specifies a number of frames that must pass
Commit: d008f85d3c88678b82848b3174e8c7fbc38bda22
https://github.com/scummvm/scummvm/commit/d008f85d3c88678b82848b3174e8c7fbc38bda22
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-02-04T14:59:31+01:00
Commit Message:
DIRECTOR: Override debugger prompt in repl mode
Changed paths:
engines/director/debugger.cpp
diff --git a/engines/director/debugger.cpp b/engines/director/debugger.cpp
index c7d5ba20b29..e219f30dfa0 100644
--- a/engines/director/debugger.cpp
+++ b/engines/director/debugger.cpp
@@ -37,7 +37,7 @@
namespace Director {
-#define PROMPT "lingo"
+#define PROMPT "lingo) "
Debugger *g_debugger;
@@ -312,7 +312,7 @@ bool Debugger::cmdRepl(int argc, const char **argv) {
debugPrintf("Switching to Lingo REPL mode, type 'lingo off' to return to the debug console.\n");
registerDefaultCmd(WRAP_DEFAULTCOMMAND(Debugger, lingoCommandProcessor));
_lingoReplMode = true;
- debugPrintf(PROMPT);
+ setPrompt(PROMPT);
return true;
}
@@ -869,12 +869,11 @@ bool Debugger::lingoCommandProcessor(const char *inputOrig) {
if (!strcmp(inputOrig, "lingo off")) {
registerDefaultCmd(nullptr);
_lingoReplMode = false;
+ resetPrompt();
return true;
}
bool ret = lingoEval(inputOrig);
- debugPrintf(PROMPT);
-
return ret;
}
@@ -887,7 +886,7 @@ bool Debugger::lingoEval(const char *inputOrig) {
// Compile the code to an anonymous function and call it
ScriptContext *sc = g_lingo->_compiler->compileAnonymous(inputSan);
if (!sc) {
- debugPrintf("Failed to parse expression!\n%s", _lingoReplMode ? PROMPT : "");
+ debugPrintf("Failed to parse expression!\n");
return true;
}
Symbol sym = sc->_eventHandlers[kEventGeneric];
@@ -916,7 +915,7 @@ void Debugger::stepHook() {
if (_lingoEval) {
_lingoEval = false;
Datum result = g_lingo->pop();
- debugPrintf("%s\n\n%s", result.asString(true).c_str(), _lingoReplMode ? PROMPT : "");
+ debugPrintf("%s\n\n", result.asString(true).c_str());
} else {
cmdScriptFrame(0, nullptr);
}
More information about the Scummvm-git-logs
mailing list