diff --git a/doc/help/settings.asciidoc b/doc/help/settings.asciidoc index d1fcf2822..f2a2ba5da 100644 --- a/doc/help/settings.asciidoc +++ b/doc/help/settings.asciidoc @@ -239,7 +239,7 @@ |<>|Position of new tabs opened from another tab. |<>|Position of new tabs which aren't opened from another tab. |<>|Padding (in pixels) around text for tabs. -|<>|When switching tabs, retain the current mode. +|<>|When switching tabs, stay in insert/passthrough mode. |<>|Shrink pinned tabs down to their contents. |<>|Position of the tab bar. |<>|Which tab to select when the focused tab is removed. @@ -2802,7 +2802,7 @@ Default: [[tabs.persist_mode_on_change]] === tabs.persist_mode_on_change -When switching tabs, retain the current mode. +When switching tabs, stay in insert/passthrough mode. Type: <> diff --git a/qutebrowser/config/configdata.yml b/qutebrowser/config/configdata.yml index 56a0801c4..822cef76b 100644 --- a/qutebrowser/config/configdata.yml +++ b/qutebrowser/config/configdata.yml @@ -1238,7 +1238,7 @@ tabs.padding: tabs.persist_mode_on_change: default: false type: Bool - desc: When switching tabs, retain the current mode. + desc: When switching tabs, stay in insert/passthrough mode. tabs.position: default: top diff --git a/qutebrowser/mainwindow/tabbedbrowser.py b/qutebrowser/mainwindow/tabbedbrowser.py index 9480adc5f..c78c0eced 100644 --- a/qutebrowser/mainwindow/tabbedbrowser.py +++ b/qutebrowser/mainwindow/tabbedbrowser.py @@ -652,11 +652,14 @@ class TabbedBrowser(tabwidget.TabWidget): log.modes.debug("Current tab changed, focusing {!r}".format(tab)) tab.setFocus() + + modes_to_leave = [usertypes.KeyMode.hint, usertypes.KeyMode.caret] 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) + modes_to_leave += [usertypes.KeyMode.insert, + usertypes.KeyMode.passthrough] + for mode in modes_to_leave: + 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)