diff options
author | Florian Bruhin <me@the-compiler.org> | 2019-10-09 23:11:10 +0200 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2019-10-09 23:11:10 +0200 |
commit | 16739dabe3711f152966af702c59df83a95d5d51 (patch) | |
tree | 97c4fa01471d4421d44834e4e1ede2bedfde24d2 /qutebrowser/keyinput | |
parent | 36ac7f24704938d13ff84e7829dcfad7b64a3dd0 (diff) | |
download | qutebrowser-16739dabe3711f152966af702c59df83a95d5d51.tar.gz qutebrowser-16739dabe3711f152966af702c59df83a95d5d51.zip |
Use usertypes.KeyMode for PassthroughKeyParser mode argument
More consistency with RegisterKeyParser and more type safety
Diffstat (limited to 'qutebrowser/keyinput')
-rw-r--r-- | qutebrowser/keyinput/modeman.py | 8 | ||||
-rw-r--r-- | qutebrowser/keyinput/modeparsers.py | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/qutebrowser/keyinput/modeman.py b/qutebrowser/keyinput/modeman.py index eb9ae537a..48ae3d9c5 100644 --- a/qutebrowser/keyinput/modeman.py +++ b/qutebrowser/keyinput/modeman.py @@ -87,22 +87,22 @@ def init(win_id, parent): parent=modeman), usertypes.KeyMode.insert: modeparsers.PassthroughKeyParser(win_id=win_id, - mode='insert', + mode=usertypes.KeyMode.insert, commandrunner=commandrunner, parent=modeman), usertypes.KeyMode.passthrough: modeparsers.PassthroughKeyParser(win_id=win_id, - mode='passthrough', + mode=usertypes.KeyMode.passthrough, commandrunner=commandrunner, parent=modeman), usertypes.KeyMode.command: modeparsers.PassthroughKeyParser(win_id=win_id, - mode='command', + mode=usertypes.KeyMode.command, commandrunner=commandrunner, parent=modeman), usertypes.KeyMode.prompt: modeparsers.PassthroughKeyParser(win_id=win_id, - mode='prompt', + mode=usertypes.KeyMode.prompt, commandrunner=commandrunner, parent=modeman), usertypes.KeyMode.yesno: diff --git a/qutebrowser/keyinput/modeparsers.py b/qutebrowser/keyinput/modeparsers.py index e4366bcb5..55e1e3683 100644 --- a/qutebrowser/keyinput/modeparsers.py +++ b/qutebrowser/keyinput/modeparsers.py @@ -143,7 +143,7 @@ class PassthroughKeyParser(CommandKeyParser): supports_count = False def __init__(self, win_id: int, - mode: str, + mode: usertypes.KeyMode, commandrunner: runners.CommandRunner, parent: QObject = None) -> None: """Constructor. @@ -154,7 +154,7 @@ class PassthroughKeyParser(CommandKeyParser): warn: Whether to warn if an ignored key was bound. """ super().__init__(win_id, commandrunner, parent) - self._read_config(mode) + self._read_config(mode.name) self._mode = mode def __repr__(self) -> str: |