@@ -890,56 +890,56 @@ void RPCConsole::on_lineEdit_returnPressed()
890890{
891891 QString cmd = ui->lineEdit ->text ();
892892
893- if (!cmd.isEmpty ())
894- {
895- std::string strFilteredCmd;
896- try {
897- std::string dummy;
898- if (!RPCParseCommandLine (nullptr , dummy, cmd.toStdString (), false , &strFilteredCmd)) {
899- // Failed to parse command, so we cannot even filter it for the history
900- throw std::runtime_error (" Invalid command line" );
901- }
902- } catch (const std::exception& e) {
903- QMessageBox::critical (this , " Error" , QString (" Error: " ) + QString::fromStdString (e.what ()));
904- return ;
905- }
893+ if (cmd.isEmpty ()) {
894+ return ;
895+ }
906896
907- ui->lineEdit ->clear ();
897+ std::string strFilteredCmd;
898+ try {
899+ std::string dummy;
900+ if (!RPCParseCommandLine (nullptr , dummy, cmd.toStdString (), false , &strFilteredCmd)) {
901+ // Failed to parse command, so we cannot even filter it for the history
902+ throw std::runtime_error (" Invalid command line" );
903+ }
904+ } catch (const std::exception& e) {
905+ QMessageBox::critical (this , " Error" , QString (" Error: " ) + QString::fromStdString (e.what ()));
906+ return ;
907+ }
908908
909- cmdBeforeBrowsing = QString ();
909+ ui-> lineEdit -> clear ();
910910
911911#ifdef ENABLE_WALLET
912- WalletModel* wallet_model = ui->WalletSelector ->currentData ().value <WalletModel*>();
912+ WalletModel* wallet_model = ui->WalletSelector ->currentData ().value <WalletModel*>();
913913
914- if (m_last_wallet_model != wallet_model) {
915- if (wallet_model) {
916- message (CMD_REQUEST, tr (" Executing command using \" %1\" wallet" ).arg (wallet_model->getWalletName ()));
917- } else {
918- message (CMD_REQUEST, tr (" Executing command without any wallet" ));
919- }
920- m_last_wallet_model = wallet_model;
914+ if (m_last_wallet_model != wallet_model) {
915+ if (wallet_model) {
916+ message (CMD_REQUEST, tr (" Executing command using \" %1\" wallet" ).arg (wallet_model->getWalletName ()));
917+ } else {
918+ message (CMD_REQUEST, tr (" Executing command without any wallet" ));
921919 }
922- #endif
923-
924- message (CMD_REQUEST, QString::fromStdString (strFilteredCmd));
925- message (CMD_REPLY, " Executing..." );
926- Q_EMIT cmdRequest (cmd, m_last_wallet_model);
920+ m_last_wallet_model = wallet_model;
921+ }
922+ #endif // ENABLE_WALLET
927923
928- cmd = QString::fromStdString (strFilteredCmd);
924+ message (CMD_REQUEST, QString::fromStdString (strFilteredCmd));
925+ message (CMD_REPLY, " Executing..." );
926+ Q_EMIT cmdRequest (cmd, m_last_wallet_model);
929927
930- // Remove command, if already in history
931- history.removeOne (cmd);
932- // Append command to history
933- history.append (cmd);
934- // Enforce maximum history size
935- while (history.size () > CONSOLE_HISTORY)
936- history.removeFirst ();
937- // Set pointer to end of history
938- historyPtr = history.size ();
928+ cmd = QString::fromStdString (strFilteredCmd);
939929
940- // Scroll console view to end
941- scrollToEnd ();
930+ // Remove command, if already in history
931+ history.removeOne (cmd);
932+ // Append command to history
933+ history.append (cmd);
934+ // Enforce maximum history size
935+ while (history.size () > CONSOLE_HISTORY) {
936+ history.removeFirst ();
942937 }
938+ // Set pointer to end of history
939+ historyPtr = history.size ();
940+
941+ // Scroll console view to end
942+ scrollToEnd ();
943943}
944944
945945void RPCConsole::browseHistory (int offset)
0 commit comments