diff --git a/docs/debugger.html b/docs/debugger.html index 8ea40d64b..97e3b0161 100644 --- a/docs/debugger.html +++ b/docs/debugger.html @@ -936,6 +936,7 @@ Type "help 'cmd'" to see extended information about the given command.

cheat - Use a cheat code (see manual for cheat types) clearBreaks - Clear all breakpoints clearConfig - Clear DiStella config directives [bank xx] + clearHistory - Clear the prompt history clearSaveStateIfs - Clear all saveState points clearTraps - Clear all traps clearWatches - Clear all watches diff --git a/src/debugger/DebuggerParser.cxx b/src/debugger/DebuggerParser.cxx index e1503eb01..94f9139c6 100644 --- a/src/debugger/DebuggerParser.cxx +++ b/src/debugger/DebuggerParser.cxx @@ -950,6 +950,14 @@ void DebuggerParser::executeClearConfig() commandResult << debugger.cartDebug().clearConfig(); } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +// "clearHistory" +void DebuggerParser::executeClearHistory() +{ + debugger.prompt().clearHistory(); + commandResult << ""; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // "clearBreaks" void DebuggerParser::executeClearSaveStateIfs() @@ -2600,6 +2608,16 @@ DebuggerParser::CommandArray DebuggerParser::commands = { { std::mem_fn(&DebuggerParser::executeClearConfig) }, + { + "clearHistory", + "Clear the prompt history", + "Example: clearhisotry (no parameters)", + false, + true, + { Parameters::ARG_END_ARGS }, + std::mem_fn(&DebuggerParser::executeClearHistory) + }, + { "clearSaveStateIfs", "Clear all saveState points", diff --git a/src/debugger/DebuggerParser.hxx b/src/debugger/DebuggerParser.hxx index 040bed485..89cea1abe 100644 --- a/src/debugger/DebuggerParser.hxx +++ b/src/debugger/DebuggerParser.hxx @@ -101,7 +101,7 @@ class DebuggerParser std::array parms; std::function executor; }; - using CommandArray = std::array; + using CommandArray = std::array; static CommandArray commands; struct Trap @@ -159,6 +159,7 @@ class DebuggerParser void executeCheat(); void executeClearBreaks(); void executeClearConfig(); + void executeClearHistory(); void executeClearSaveStateIfs(); void executeClearTraps(); void executeClearWatches(); diff --git a/src/debugger/gui/PromptWidget.cxx b/src/debugger/gui/PromptWidget.cxx index 5891aa276..175d4ab42 100644 --- a/src/debugger/gui/PromptWidget.cxx +++ b/src/debugger/gui/PromptWidget.cxx @@ -966,6 +966,13 @@ void PromptWidget::clearScreen() resetFunctions(); } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void PromptWidget::clearHistory() +{ + _history.clear(); + _historyIndex = 0; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void PromptWidget::resetFunctions() { diff --git a/src/debugger/gui/PromptWidget.hxx b/src/debugger/gui/PromptWidget.hxx index b3f30b03a..bf96f935a 100644 --- a/src/debugger/gui/PromptWidget.hxx +++ b/src/debugger/gui/PromptWidget.hxx @@ -46,8 +46,10 @@ class PromptWidget : public Widget, public CommandSender void printPrompt(); string saveBuffer(const FilesystemNode& file); - // Clear screen and erase all history + // Clear screen void clearScreen(); + // Erase all history + void clearHistory(); void addToHistory(const char *str);