From b791dd3eb4966a41e6cebae76b9613b558eaaa20 Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Wed, 14 Feb 2018 09:44:40 -0500 Subject: [PATCH] no restore while in prompt modes on tab change --- qutebrowser/mainwindow/tabbedbrowser.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/qutebrowser/mainwindow/tabbedbrowser.py b/qutebrowser/mainwindow/tabbedbrowser.py index a5cf7958e..64fdfed10 100644 --- a/qutebrowser/mainwindow/tabbedbrowser.py +++ b/qutebrowser/mainwindow/tabbedbrowser.py @@ -673,13 +673,18 @@ class TabbedBrowser(tabwidget.TabWidget): log.modes.debug("Current tab changed, focusing {!r}".format(tab)) tab.setFocus() + prompt_modes = [usertypes.KeyMode.prompt, usertypes.KeyMode.yesno] modes_to_leave = [usertypes.KeyMode.hint, usertypes.KeyMode.caret] + + mm_instance = modeman.instance(self._win_id) + current_mode = mm_instance.mode + if mode_on_change == 'normal': 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 mode_on_change == 'restore': + if mode_on_change == 'restore' and current_mode not in prompt_modes: modeman.enter(self._win_id, tab.data.input_mode, 'restore') if self._now_focused is not None: objreg.register('last-focused-tab', self._now_focused, update=True,