From 0e327c4ec48f008aba19d7170b1ed8c2419a17a2 Mon Sep 17 00:00:00 2001 From: Jay Kamat Date: Tue, 16 Oct 2018 18:42:37 -0700 Subject: [PATCH] Always leave hint mode - Also handle invalid URLs properly through catching the QtValueError --- qutebrowser/mainwindow/tabbedbrowser.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/qutebrowser/mainwindow/tabbedbrowser.py b/qutebrowser/mainwindow/tabbedbrowser.py index 19a6d67b2..092f18e2f 100644 --- a/qutebrowser/mainwindow/tabbedbrowser.py +++ b/qutebrowser/mainwindow/tabbedbrowser.py @@ -584,14 +584,18 @@ class TabbedBrowser(QWidget): @pyqtSlot() def on_cur_load_started(self): """Leave insert/hint mode when loading started.""" + try: + url = self.current_url() + except qtutils.QtValueError: + url = None if config.instance.get('input.insert_mode.leave_on_load', - url=self.current_url()): + url=url): modeman.leave(self._win_id, usertypes.KeyMode.insert, 'load started', maybe=True) - modeman.leave(self._win_id, usertypes.KeyMode.hint, - 'load started', maybe=True) else: log.modes.debug("Ignoring leave_on_load request due to setting.") + modeman.leave(self._win_id, usertypes.KeyMode.hint, + 'load started', maybe=True) @pyqtSlot(browsertab.AbstractTab, str) def on_title_changed(self, tab, text):