File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -751,6 +751,8 @@ void RPCConsole::on_lineEdit_returnPressed()
751
751
752
752
if (!cmd.isEmpty ())
753
753
{
754
+ cmdBeforeBrowsing = QString ();
755
+
754
756
message (CMD_REQUEST, cmd);
755
757
Q_EMIT cmdRequest (cmd);
756
758
// Remove command, if already in history
@@ -769,6 +771,11 @@ void RPCConsole::on_lineEdit_returnPressed()
769
771
770
772
void RPCConsole::browseHistory (int offset)
771
773
{
774
+ // store current text when start browsing through the history
775
+ if (historyPtr == history.size ()) {
776
+ cmdBeforeBrowsing = ui->lineEdit ->text ();
777
+ }
778
+
772
779
historyPtr += offset;
773
780
if (historyPtr < 0 )
774
781
historyPtr = 0 ;
@@ -777,6 +784,9 @@ void RPCConsole::browseHistory(int offset)
777
784
QString cmd;
778
785
if (historyPtr < history.size ())
779
786
cmd = history.at (historyPtr);
787
+ else if (!cmdBeforeBrowsing.isNull ()) {
788
+ cmd = cmdBeforeBrowsing;
789
+ }
780
790
ui->lineEdit ->setText (cmd);
781
791
}
782
792
Original file line number Diff line number Diff line change @@ -140,6 +140,7 @@ public Q_SLOTS:
140
140
ClientModel *clientModel;
141
141
QStringList history;
142
142
int historyPtr;
143
+ QString cmdBeforeBrowsing;
143
144
QList<NodeId> cachedNodeids;
144
145
const PlatformStyle *platformStyle;
145
146
RPCTimerInterface *rpcTimerInterface;
You can’t perform that action at this time.
0 commit comments