diff --git a/qutebrowser/widgets/misc.py b/qutebrowser/widgets/misc.py index 948f83680..2f6bfa903 100644 --- a/qutebrowser/widgets/misc.py +++ b/qutebrowser/widgets/misc.py @@ -85,6 +85,13 @@ class CommandLineEdit(QLineEdit): self._validator.prompt = 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): return '<{} "{}">'.format(self.__class__.__name__, self.text())