Add rudimentary support for URL patterns in leave_on_load

This commit is contained in:
Jay Kamat 2018-10-15 19:11:32 -07:00
parent 975508f4ea
commit 3d5caba7d4
No known key found for this signature in database
GPG Key ID: 5D2E399600F4F7B5
2 changed files with 8 additions and 2 deletions

View File

@ -1273,7 +1273,12 @@ input.insert_mode.plugins:
input.insert_mode.leave_on_load:
default: true
type: Bool
desc: Leave insert mode when starting a new page load.
supports_pattern: true
desc: >-
Leave insert mode when starting a new page load.
Patterns may be unreliable on this setting, and they may match the url you
are navigating to, or the URL you are navigating from.
input.links_included_in_focus_chain:
default: true

View File

@ -584,7 +584,8 @@ class TabbedBrowser(QWidget):
@pyqtSlot()
def on_cur_load_started(self):
"""Leave insert/hint mode when loading started."""
if config.val.input.insert_mode.leave_on_load:
if config.instance.get('input.insert_mode.leave_on_load',
url=self.current_url()):
modeman.leave(self._win_id, usertypes.KeyMode.insert,
'load started', maybe=True)
modeman.leave(self._win_id, usertypes.KeyMode.hint,