Stop history browsing at the correct places.
This commit is contained in:
parent
9c69ea3c45
commit
47e405dda5
@ -64,6 +64,7 @@ class ConsoleLineEdit(CommandLineEdit):
|
|||||||
@pyqtSlot(str)
|
@pyqtSlot(str)
|
||||||
def execute(self):
|
def execute(self):
|
||||||
"""Execute the line of code which was entered."""
|
"""Execute the line of code which was entered."""
|
||||||
|
self.history.stop()
|
||||||
text = self.text()
|
text = self.text()
|
||||||
self.history.append(text)
|
self.history.append(text)
|
||||||
self.push(text)
|
self.push(text)
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
"""Misc. widgets used at different places."""
|
"""Misc. widgets used at different places."""
|
||||||
|
|
||||||
|
from PyQt5.QtCore import pyqtSlot
|
||||||
from PyQt5.QtWidgets import QLineEdit
|
from PyQt5.QtWidgets import QLineEdit
|
||||||
from PyQt5.QtGui import QValidator
|
from PyQt5.QtGui import QValidator
|
||||||
|
|
||||||
@ -61,6 +62,12 @@ class CommandLineEdit(QLineEdit):
|
|||||||
self.history = History()
|
self.history = History()
|
||||||
self._validator = _CommandValidator(validator, parent=self)
|
self._validator = _CommandValidator(validator, parent=self)
|
||||||
self.setValidator(self._validator)
|
self.setValidator(self._validator)
|
||||||
|
self.textEdited.connect(self.on_text_edited)
|
||||||
|
|
||||||
|
@pyqtSlot(str)
|
||||||
|
def on_text_edited(self, _text):
|
||||||
|
"""Slot for textEdited. Stop history browsing."""
|
||||||
|
self.history.stop()
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return '<{} "{}">'.format(self.__class__.__name__, self.text())
|
return '<{} "{}">'.format(self.__class__.__name__, self.text())
|
||||||
|
Loading…
Reference in New Issue
Block a user