Add option to persist current mode on tab change

This commit is contained in:
Vladimir Shulyak 2017-11-21 18:57:41 +00:00
parent b684e50cdf
commit 7532db83c4
2 changed files with 9 additions and 3 deletions

View File

@ -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

View File

@ -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)