Add setting to avoid leaving insert mode on load_started
It looks like load_started can be emitted for a lot of things, such as an anchor change, and some people may not want to leave insert mode on reload anyway.
This commit is contained in:
parent
87dffa5afc
commit
975508f4ea
@ -1270,6 +1270,11 @@ input.insert_mode.plugins:
|
|||||||
type: Bool
|
type: Bool
|
||||||
desc: Switch to insert mode when clicking flash and other plugins.
|
desc: Switch to insert mode when clicking flash and other plugins.
|
||||||
|
|
||||||
|
input.insert_mode.leave_on_load:
|
||||||
|
default: true
|
||||||
|
type: Bool
|
||||||
|
desc: Leave insert mode when starting a new page load.
|
||||||
|
|
||||||
input.links_included_in_focus_chain:
|
input.links_included_in_focus_chain:
|
||||||
default: true
|
default: true
|
||||||
type: Bool
|
type: Bool
|
||||||
|
@ -584,10 +584,13 @@ class TabbedBrowser(QWidget):
|
|||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
def on_cur_load_started(self):
|
def on_cur_load_started(self):
|
||||||
"""Leave insert/hint mode when loading started."""
|
"""Leave insert/hint mode when loading started."""
|
||||||
modeman.leave(self._win_id, usertypes.KeyMode.insert, 'load started',
|
if config.val.input.insert_mode.leave_on_load:
|
||||||
maybe=True)
|
modeman.leave(self._win_id, usertypes.KeyMode.insert,
|
||||||
modeman.leave(self._win_id, usertypes.KeyMode.hint, 'load started',
|
'load started', maybe=True)
|
||||||
maybe=True)
|
modeman.leave(self._win_id, usertypes.KeyMode.hint,
|
||||||
|
'load started', maybe=True)
|
||||||
|
else:
|
||||||
|
log.modes.debug("Ignoring leave_on_load request due to setting.")
|
||||||
|
|
||||||
@pyqtSlot(browsertab.AbstractTab, str)
|
@pyqtSlot(browsertab.AbstractTab, str)
|
||||||
def on_title_changed(self, tab, text):
|
def on_title_changed(self, tab, text):
|
||||||
|
@ -85,3 +85,19 @@ def test_auto_leave_insert_mode(quteproc):
|
|||||||
# Select the disabled input box to leave insert mode
|
# Select the disabled input box to leave insert mode
|
||||||
quteproc.send_cmd(':follow-hint s')
|
quteproc.send_cmd(':follow-hint s')
|
||||||
quteproc.wait_for(message='Clicked non-editable element!')
|
quteproc.wait_for(message='Clicked non-editable element!')
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('leave_on_load', [True, False])
|
||||||
|
def test_auto_leave_insert_mode_reload(quteproc, leave_on_load):
|
||||||
|
url_path = 'data/hello.txt'
|
||||||
|
quteproc.open_path(url_path)
|
||||||
|
|
||||||
|
quteproc.set_setting('input.insert_mode.leave_on_load', str(leave_on_load).lower())
|
||||||
|
quteproc.send_cmd(':enter-mode insert')
|
||||||
|
quteproc.wait_for(message='Entering mode KeyMode.insert (reason: *)')
|
||||||
|
quteproc.send_cmd(':reload')
|
||||||
|
if leave_on_load:
|
||||||
|
quteproc.wait_for(message='Leaving mode KeyMode.insert (reason: *)')
|
||||||
|
else:
|
||||||
|
quteproc.wait_for(
|
||||||
|
message='Ignoring leave_on_load request due to setting.')
|
||||||
|
Loading…
Reference in New Issue
Block a user