add commands from 'exec' script to prompt history

This commit is contained in:
Thomas Jentzsch 2019-08-20 10:27:42 +02:00
parent 0049a968bb
commit b1f841cccc
3 changed files with 10 additions and 3 deletions

View File

@ -1177,9 +1177,16 @@ void DebuggerParser::executeExec()
<< uInt32(TimerManager::getTicks()/1000);
execPrefix = prefix.str();
}
// make sure the commands are added to prompt history
StringList history;
++execDepth;
commandResult << exec(node);
commandResult << exec(node, &history);
--execDepth;
for(const auto& item : history)
debugger.prompt().addToHistory(item.c_str());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -784,7 +784,6 @@ void PromptWidget::nextLine()
updateScrollBuffer();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Call this (at least) when the current line changes or when a new line is added
void PromptWidget::updateScrollBuffer()

View File

@ -51,6 +51,8 @@ class PromptWidget : public Widget, public CommandSender
// Clear screen and erase all history
void clearScreen();
void addToHistory(const char *str);
protected:
int& buffer(int idx) { return _buffer[idx % kBufferSize]; }
@ -75,7 +77,6 @@ class PromptWidget : public Widget, public CommandSender
void textPaste();
// History
void addToHistory(const char *str);
void historyScroll(int direction);
void handleMouseDown(int x, int y, MouseButton b, int clickCount) override;