From 7532db83c44374740ccaf0a8cd268f998843f2fc Mon Sep 17 00:00:00 2001 From: Vladimir Shulyak Date: Tue, 21 Nov 2017 18:57:41 +0000 Subject: [PATCH 1/2] Add option to persist current mode on tab change --- qutebrowser/config/configdata.yml | 5 +++++ qutebrowser/mainwindow/tabbedbrowser.py | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/qutebrowser/config/configdata.yml b/qutebrowser/config/configdata.yml index 5ed18c33f..56a0801c4 100644 --- a/qutebrowser/config/configdata.yml +++ b/qutebrowser/config/configdata.yml @@ -1235,6 +1235,11 @@ tabs.padding: type: Padding desc: Padding (in pixels) around text for tabs. +tabs.persist_mode_on_change: + default: false + type: Bool + desc: When switching tabs, retain the current mode. + tabs.position: default: top type: Position diff --git a/qutebrowser/mainwindow/tabbedbrowser.py b/qutebrowser/mainwindow/tabbedbrowser.py index 2338d5dc9..9b26c4028 100644 --- a/qutebrowser/mainwindow/tabbedbrowser.py +++ b/qutebrowser/mainwindow/tabbedbrowser.py @@ -652,9 +652,10 @@ class TabbedBrowser(tabwidget.TabWidget): log.modes.debug("Current tab changed, focusing {!r}".format(tab)) tab.setFocus() - for mode in [usertypes.KeyMode.hint, usertypes.KeyMode.insert, - usertypes.KeyMode.caret, usertypes.KeyMode.passthrough]: - modeman.leave(self._win_id, mode, 'tab changed', maybe=True) + if not config.val.tabs.persist_mode_on_change: + for mode in [usertypes.KeyMode.hint, usertypes.KeyMode.insert, + usertypes.KeyMode.caret, usertypes.KeyMode.passthrough]: + modeman.leave(self._win_id, mode, 'tab changed', maybe=True) if self._now_focused is not None: objreg.register('last-focused-tab', self._now_focused, update=True, scope='window', window=self._win_id) From 358c888760de8bfa39ec5cdc330388eea46dd9dd Mon Sep 17 00:00:00 2001 From: Vladimir Shulyak Date: Tue, 21 Nov 2017 22:35:19 +0000 Subject: [PATCH 2/2] Fix long line --- qutebrowser/mainwindow/tabbedbrowser.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qutebrowser/mainwindow/tabbedbrowser.py b/qutebrowser/mainwindow/tabbedbrowser.py index 9b26c4028..9480adc5f 100644 --- a/qutebrowser/mainwindow/tabbedbrowser.py +++ b/qutebrowser/mainwindow/tabbedbrowser.py @@ -654,7 +654,8 @@ class TabbedBrowser(tabwidget.TabWidget): tab.setFocus() if not config.val.tabs.persist_mode_on_change: for mode in [usertypes.KeyMode.hint, usertypes.KeyMode.insert, - usertypes.KeyMode.caret, usertypes.KeyMode.passthrough]: + usertypes.KeyMode.caret, + usertypes.KeyMode.passthrough]: modeman.leave(self._win_id, mode, 'tab changed', maybe=True) if self._now_focused is not None: objreg.register('last-focused-tab', self._now_focused, update=True,