qt console history: ensure partial writes
This commit is contained in:
@@ -187,6 +187,8 @@ class Console(QtWidgets.QPlainTextEdit):
|
|||||||
return
|
return
|
||||||
|
|
||||||
if command and (not self.history or self.history[-1] != command):
|
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.append(command)
|
||||||
self.history_index = len(self.history)
|
self.history_index = len(self.history)
|
||||||
|
|
||||||
|
|||||||
@@ -1550,7 +1550,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger, QtEventListener):
|
|||||||
|
|
||||||
def update_console(self):
|
def update_console(self):
|
||||||
console = self.console
|
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.history_index = len(console.history)
|
||||||
|
|
||||||
console.updateNamespace({
|
console.updateNamespace({
|
||||||
@@ -2620,7 +2620,6 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger, QtEventListener):
|
|||||||
g = self.geometry()
|
g = self.geometry()
|
||||||
self.wallet.db.put("winpos-qt", [g.left(),g.top(),
|
self.wallet.db.put("winpos-qt", [g.left(),g.top(),
|
||||||
g.width(),g.height()])
|
g.width(),g.height()])
|
||||||
self.wallet.db.put("qt-console-history", self.console.history[-50:])
|
|
||||||
if self.qr_window:
|
if self.qr_window:
|
||||||
self.qr_window.close()
|
self.qr_window.close()
|
||||||
self.close_wallet()
|
self.close_wallet()
|
||||||
|
|||||||
Reference in New Issue
Block a user