Forward unbound non-alphanumeric keys by default.
We do this so we benefit from some default WebKit keybindings users would expect. For example, we'd need to bind Ctrl+X/C/V by default without this. We also remove the custom-bound scrolling keybindings as they're redundant now. The forward-unbound-keys setting now isn't a bool anymore, instead it can be set to all/auto/none.
This commit is contained in:
parent
e6f9c0ccea
commit
fdda1dd3a0
@ -376,8 +376,8 @@ DATA = OrderedDict([
|
|||||||
"is focused after page load."),
|
"is focused after page load."),
|
||||||
|
|
||||||
('forward-unbound-keys',
|
('forward-unbound-keys',
|
||||||
SettingValue(types.Bool(), 'false'),
|
SettingValue(types.ForwardUnboundKeys(), 'auto'),
|
||||||
"Whether to forward unbound keys to the website in normal mode."),
|
"Whether to forward unbound keys to the webview in normal mode."),
|
||||||
|
|
||||||
('spatial-navigation',
|
('spatial-navigation',
|
||||||
SettingValue(types.Bool(), 'false'),
|
SettingValue(types.Bool(), 'false'),
|
||||||
@ -678,14 +678,6 @@ DATA = OrderedDict([
|
|||||||
('<Alt-8>', 'tab-focus 8'),
|
('<Alt-8>', 'tab-focus 8'),
|
||||||
('<Alt-9>', 'tab-focus 9'),
|
('<Alt-9>', 'tab-focus 9'),
|
||||||
('<Backspace>', 'back'),
|
('<Backspace>', 'back'),
|
||||||
('<Left>', 'scroll -50 0'),
|
|
||||||
('<Down>', 'scroll 0 50'),
|
|
||||||
('<Up>', 'scroll 0 -50'),
|
|
||||||
('<Right>', 'scroll 50 0'),
|
|
||||||
('<Shift-Space>', 'scroll-page 0 -1'),
|
|
||||||
('<Space>', 'scroll-page 0 1'),
|
|
||||||
('<PgUp>', 'scroll-page 0 -1'),
|
|
||||||
('<PgDown>', 'scroll-page 0 1'),
|
|
||||||
('<Ctrl-h>', 'home'),
|
('<Ctrl-h>', 'home'),
|
||||||
('<Ctrl-s>', 'stop'),
|
('<Ctrl-s>', 'stop'),
|
||||||
('<Ctrl-Alt-p>', 'print'),
|
('<Ctrl-Alt-p>', 'print'),
|
||||||
|
@ -916,3 +916,13 @@ class ConfirmQuit(String):
|
|||||||
('multiple-tabs', "Show a confirmation if "
|
('multiple-tabs', "Show a confirmation if "
|
||||||
"multiple tabs are opened."),
|
"multiple tabs are opened."),
|
||||||
('never', "Never show a confirmation."))
|
('never', "Never show a confirmation."))
|
||||||
|
|
||||||
|
|
||||||
|
class ForwardUnboundKeys(String):
|
||||||
|
|
||||||
|
"""Whether to forward unbound keys."""
|
||||||
|
|
||||||
|
valid_values = ValidValues(('all', "Forward all unbound keys."),
|
||||||
|
('auto', "Forward unbound non-alphanumeric "
|
||||||
|
"keys."),
|
||||||
|
('none', "Don't forward any keys."))
|
||||||
|
@ -184,7 +184,7 @@ class BaseKeyParser(QObject):
|
|||||||
self._keystring = ''
|
self._keystring = ''
|
||||||
return
|
return
|
||||||
|
|
||||||
if txt not in (string.ascii_letters + string.digits +
|
if (not txt) or txt not in (string.ascii_letters + string.digits +
|
||||||
string.punctuation):
|
string.punctuation):
|
||||||
logger.debug("Ignoring, no text char")
|
logger.debug("Ignoring, no text char")
|
||||||
return False
|
return False
|
||||||
|
@ -127,9 +127,13 @@ class ModeManager(QObject):
|
|||||||
logger.debug("calling handler {}".format(handler.__qualname__))
|
logger.debug("calling handler {}".format(handler.__qualname__))
|
||||||
handled = handler(event) if handler is not None else False
|
handled = handler(event) if handler is not None else False
|
||||||
|
|
||||||
|
is_non_alnum = event.modifiers() or not event.text().strip()
|
||||||
|
|
||||||
if handled:
|
if handled:
|
||||||
filter_this = True
|
filter_this = True
|
||||||
elif self.mode in self.passthrough or self._forward_unbound_keys:
|
elif (self.mode in self.passthrough or
|
||||||
|
self._forward_unbound_keys == 'all' or
|
||||||
|
(self._forward_unbound_keys == 'auto' and is_non_alnum)):
|
||||||
filter_this = False
|
filter_this = False
|
||||||
else:
|
else:
|
||||||
filter_this = True
|
filter_this = True
|
||||||
@ -137,10 +141,10 @@ class ModeManager(QObject):
|
|||||||
if not filter_this:
|
if not filter_this:
|
||||||
self._releaseevents_to_pass.append(event)
|
self._releaseevents_to_pass.append(event)
|
||||||
|
|
||||||
logger.debug("handled: {}, forward-unbound-keys: {}, passthrough: {} "
|
logger.debug("handled: {}, forward-unbound-keys: {}, passthrough: {}, "
|
||||||
"--> filter: {}".format(handled,
|
"is_non_alnum: {} --> filter: {}".format(
|
||||||
self._forward_unbound_keys,
|
handled, self._forward_unbound_keys,
|
||||||
self.mode in self.passthrough,
|
self.mode in self.passthrough, is_non_alnum,
|
||||||
filter_this))
|
filter_this))
|
||||||
return filter_this
|
return filter_this
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user