aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJonas Schnelli <jonas.schnelli@include7.ch>2015-03-13 21:51:27 +0100
committerLuke Dashjr <luke-jr+git@utopios.org>2016-12-29 11:43:28 +0000
commitfc95daa97f324f6a8b3643a3d3c5e8f909d46c35 (patch)
treedae2701c86e23ddf50969084b3c28cb9597f7a87 /src
parentdce853ef76ef90c46d84294225088d595467d08c (diff)
Qt/RPCConsole: Save current command entry when browsing history
Shell-like, but doesn't store changed history commands until executing it.
Diffstat (limited to 'src')
-rw-r--r--src/qt/rpcconsole.cpp10
-rw-r--r--src/qt/rpcconsole.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp
index cfe197de2a..5610e8b6ca 100644
--- a/src/qt/rpcconsole.cpp
+++ b/src/qt/rpcconsole.cpp
@@ -751,6 +751,8 @@ void RPCConsole::on_lineEdit_returnPressed()
if(!cmd.isEmpty())
{
+ cmdBeforeBrowsing = QString();
+
message(CMD_REQUEST, cmd);
Q_EMIT cmdRequest(cmd);
// Remove command, if already in history
@@ -769,6 +771,11 @@ void RPCConsole::on_lineEdit_returnPressed()
void RPCConsole::browseHistory(int offset)
{
+ // store current text when start browsing through the history
+ if (historyPtr == history.size()) {
+ cmdBeforeBrowsing = ui->lineEdit->text();
+ }
+
historyPtr += offset;
if(historyPtr < 0)
historyPtr = 0;
@@ -777,6 +784,9 @@ void RPCConsole::browseHistory(int offset)
QString cmd;
if(historyPtr < history.size())
cmd = history.at(historyPtr);
+ else if (!cmdBeforeBrowsing.isNull()) {
+ cmd = cmdBeforeBrowsing;
+ }
ui->lineEdit->setText(cmd);
}
diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h
index ab8c3dc914..e1698711da 100644
--- a/src/qt/rpcconsole.h
+++ b/src/qt/rpcconsole.h
@@ -140,6 +140,7 @@ private:
ClientModel *clientModel;
QStringList history;
int historyPtr;
+ QString cmdBeforeBrowsing;
QList<NodeId> cachedNodeids;
const PlatformStyle *platformStyle;
RPCTimerInterface *rpcTimerInterface;