diff --git a/electrum/gui/qt/console.py b/electrum/gui/qt/console.py index 2841fddaa..a3fd20545 100644 --- a/electrum/gui/qt/console.py +++ b/electrum/gui/qt/console.py @@ -187,6 +187,8 @@ class Console(QtWidgets.QPlainTextEdit): return if command and (not self.history or self.history[-1] != command): + while len(self.history) >= 50: + self.history.remove(self.history[0]) self.history.append(command) self.history_index = len(self.history) diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py index 80f654024..8cfae97a0 100644 --- a/electrum/gui/qt/main_window.py +++ b/electrum/gui/qt/main_window.py @@ -1550,7 +1550,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger, QtEventListener): def update_console(self): console = self.console - console.history = self.wallet.db.get("qt-console-history", []) + console.history = self.wallet.db.get_stored_item("qt-console-history", []) console.history_index = len(console.history) console.updateNamespace({ @@ -2620,7 +2620,6 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger, QtEventListener): g = self.geometry() self.wallet.db.put("winpos-qt", [g.left(),g.top(), g.width(),g.height()]) - self.wallet.db.put("qt-console-history", self.console.history[-50:]) if self.qr_window: self.qr_window.close() self.close_wallet()