Fix rl-unix-line-discard by reimplementing QLineEdit::home.
This commit is contained in:
parent
e3bb3af7ba
commit
15b8c553c8
@ -85,6 +85,13 @@ class CommandLineEdit(QLineEdit):
|
|||||||
self._validator.prompt = text
|
self._validator.prompt = text
|
||||||
self._promptlen = len(text)
|
self._promptlen = len(text)
|
||||||
|
|
||||||
|
def home(self, mark):
|
||||||
|
"""Override home so it works properly with our cursor restriction."""
|
||||||
|
oldpos = self.cursorPosition()
|
||||||
|
self.setCursorPosition(self._promptlen)
|
||||||
|
if mark:
|
||||||
|
self.setSelection(self._promptlen, oldpos - self._promptlen)
|
||||||
|
|
||||||
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