From 6b99ad95d33b7941c41340b108d2f528289d1987 Mon Sep 17 00:00:00 2001 From: Penaz91 Date: Mon, 31 Jul 2017 21:10:09 +0200 Subject: [PATCH 1/4] Proposed patch for #2858 --- qutebrowser/browser/browsertab.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/qutebrowser/browser/browsertab.py b/qutebrowser/browser/browsertab.py index b94172118..154a1b42d 100644 --- a/qutebrowser/browser/browsertab.py +++ b/qutebrowser/browser/browsertab.py @@ -706,7 +706,9 @@ class AbstractTab(QWidget): def _handle_auto_insert_mode(self, ok): """Handle auto-insert-mode after loading finished.""" - if not config.get('input', 'auto-insert-mode') or not ok: + # Checks if the tab is in foreground first, then eventually sets the mode + foreground = self is objreg.get('tabbed-browser', scope='window', window=self.win_id).currentWidget() + if not config.get('input', 'auto-insert-mode') or not foreground or not ok: return cur_mode = self._mode_manager.mode From ccba76f7577901dfb54579d5b0cf78bdc360b038 Mon Sep 17 00:00:00 2001 From: Penaz91 Date: Wed, 20 Sep 2017 13:31:44 +0200 Subject: [PATCH 2/4] Fix for Issue #2879 --- qutebrowser/browser/browsertab.py | 2 +- qutebrowser/mainwindow/tabbedbrowser.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/qutebrowser/browser/browsertab.py b/qutebrowser/browser/browsertab.py index 0b21b6b05..38219101f 100644 --- a/qutebrowser/browser/browsertab.py +++ b/qutebrowser/browser/browsertab.py @@ -753,7 +753,7 @@ class AbstractTab(QWidget): self.load_finished.emit(ok) if not self.title(): self.title_changed.emit(self.url().toDisplayString()) - self._handle_auto_insert_mode(ok) + # self._handle_auto_insert_mode(ok) @pyqtSlot() def _on_history_trigger(self): diff --git a/qutebrowser/mainwindow/tabbedbrowser.py b/qutebrowser/mainwindow/tabbedbrowser.py index 13865ba90..16fb3c924 100644 --- a/qutebrowser/mainwindow/tabbedbrowser.py +++ b/qutebrowser/mainwindow/tabbedbrowser.py @@ -689,6 +689,7 @@ class TabbedBrowser(tabwidget.TabWidget): self._update_tab_title(idx) if idx == self.currentIndex(): self._update_window_title() + tab._handle_auto_insert_mode(ok) @pyqtSlot() def on_scroll_pos_changed(self): From 7f03b0d0d57f36a222a5cd39787f97489fa3bc76 Mon Sep 17 00:00:00 2001 From: Penaz91 Date: Wed, 20 Sep 2017 13:37:40 +0200 Subject: [PATCH 3/4] Deleted a commented-out line --- qutebrowser/browser/browsertab.py | 1 - 1 file changed, 1 deletion(-) diff --git a/qutebrowser/browser/browsertab.py b/qutebrowser/browser/browsertab.py index 38219101f..a1c298282 100644 --- a/qutebrowser/browser/browsertab.py +++ b/qutebrowser/browser/browsertab.py @@ -753,7 +753,6 @@ class AbstractTab(QWidget): self.load_finished.emit(ok) if not self.title(): self.title_changed.emit(self.url().toDisplayString()) - # self._handle_auto_insert_mode(ok) @pyqtSlot() def _on_history_trigger(self): From 6132a3d7ca97b2346b74ab35b9038d627c966257 Mon Sep 17 00:00:00 2001 From: Penaz91 Date: Wed, 20 Sep 2017 15:52:07 +0200 Subject: [PATCH 4/4] Made _handle_auto_insert_mode public --- qutebrowser/browser/browsertab.py | 2 +- qutebrowser/mainwindow/tabbedbrowser.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/qutebrowser/browser/browsertab.py b/qutebrowser/browser/browsertab.py index a1c298282..34a28756e 100644 --- a/qutebrowser/browser/browsertab.py +++ b/qutebrowser/browser/browsertab.py @@ -716,7 +716,7 @@ class AbstractTab(QWidget): self._set_load_status(usertypes.LoadStatus.loading) self.load_started.emit() - def _handle_auto_insert_mode(self, ok): + def handle_auto_insert_mode(self, ok): """Handle `input.insert_mode.auto_load` after loading finished.""" if not config.val.input.insert_mode.auto_load or not ok: return diff --git a/qutebrowser/mainwindow/tabbedbrowser.py b/qutebrowser/mainwindow/tabbedbrowser.py index 16fb3c924..200107321 100644 --- a/qutebrowser/mainwindow/tabbedbrowser.py +++ b/qutebrowser/mainwindow/tabbedbrowser.py @@ -689,7 +689,7 @@ class TabbedBrowser(tabwidget.TabWidget): self._update_tab_title(idx) if idx == self.currentIndex(): self._update_window_title() - tab._handle_auto_insert_mode(ok) + tab.handle_auto_insert_mode(ok) @pyqtSlot() def on_scroll_pos_changed(self):