summaryrefslogtreecommitdiff
path: root/qutebrowser/keyinput/keyutils.py
AgeCommit message (Collapse)Author
2021-11-13fix matching bindings with modifiersJimmy
Doing `Qt.Key | Qt.KeyboardModifier` now results in a QKeyCombination. append_event() always does that (even if the modifier is NoModifier). Previous hacks round this area: e61597ca817e369c95 (initial keyhack, partially corrected in this commit) 1cc87d4d47bc15754d (initial QKeyCombination introduction) ab447bd396b46247f6 (Earlier attempt at a fix, mostly corrected in this commit)
2021-10-03even more keypress related hacksJimmy
`QKeySequence.SequenceMatch` is one of the enums for which `Enum(0)` is no-longer falsey, compare to NoMatch instead. Otherwise the conditional is always false and forwarded keys don't work. Eg > from PyQt6.QtGui import QKeySequence, QKeyEvent > bool(QKeySequence.SequenceMatch.NoMatch) True > bool(QKeySequence.SequenceMatch(0)) True For `QKeySequence.SequenceMatch` and `QtCore.Qt.Key` and `QtCore.Qt.KeyboardModifier` int(enum_value) no longer works, eg > int(QtCore.Qt.KeyboardModifier(0)) TypeError: int() argument must be a string, a bytes-like object or a number, not 'KeyboardModifier'
2021-08-26More keyboard hacksFlorian Bruhin
2021-08-26key hacksFlorian Bruhin
2021-08-26API stuffFlorian Bruhin
2021-08-26enum pluralFlorian Bruhin
2021-08-26Invalid keyFlorian Bruhin
2021-08-26Automatically rewrite enumsFlorian Bruhin
See #5904
2021-08-26Blanket PyQt5 -> PyQt6Florian Bruhin
2021-05-19mypy: Set disallow_any_genericsFlorian Bruhin
See #6100
2021-03-20Fix bindings.key_mappings with multiple keysFlorian Bruhin
Otherwise, when e.g. doing "<Meta+Up>": "gg" in bindings.key_mappings, there's a crash like: Traceback (most recent call last): File "/usr/lib/python3.9/site-packages/qutebrowser/keyinput/eventfilter.py", line 105, in eventFilter return handler(typing.cast(QKeyEvent, event)) File "/usr/lib/python3.9/site-packages/qutebrowser/keyinput/eventfilter.py", line 75, in _handle_key_event return man.handle_event(event) File "/usr/lib/python3.9/site-packages/qutebrowser/keyinput/modeman.py", line 462, in handle_event return handler(cast(QKeyEvent, event)) File "/usr/lib/python3.9/site-packages/qutebrowser/keyinput/modeman.py", line 283, in _handle_keypress match = parser.handle(event, dry_run=dry_run) File "/usr/lib/python3.9/site-packages/qutebrowser/keyinput/modeparsers.py", line 105, in handle match = super().handle(e, dry_run=dry_run) File "/usr/lib/python3.9/site-packages/qutebrowser/keyinput/basekeyparser.py", line 309, in handle result = self._match_key_mapping(result.sequence) File "/usr/lib/python3.9/site-packages/qutebrowser/keyinput/basekeyparser.py", line 246, in _match_key_mapping mapped = sequence.with_mappings( File "/usr/lib/python3.9/site-packages/qutebrowser/keyinput/keyutils.py", line 675, in with_mappings assert len(new_seq) == 1 AssertionError While this isn't the intended way to use this setting, we shouldn't crash - and let's just make it work instead of forbidding it.
2021-02-24Update changelog/commentFlorian Bruhin
2021-02-24Revert "old qt: Use ApplicationAttribute to switch Ctrl/Meta on Mac"Florian Bruhin
This reverts commit 1132324db9d665ba0f0143fb1d071995a3fc7715. Causes various issues with Qt/QtWebEngine shortcuts. Fixes #6174 Closes #6149
2021-01-26doc: Switch URLs to httpsFlorian Bruhin
2021-01-22Support Super as modifier nameFlorian Bruhin
See https://github.com/qutebrowser/qutebrowser/discussions/5999#discussioncomment-297309
2021-01-20Bump copyright yearsFlorian Bruhin
Closes #6015
2021-01-13dataclasses: Adjust import orderFlorian Bruhin
See #6023
2021-01-13dataclasses: Fix orderingFlorian Bruhin
See #6023
2021-01-13dataclasses: Initial switchFlorian Bruhin
See #6023
2020-11-04old qt: Set _SPECIAL_NAMES in keyutils directlyFlorian Bruhin
The last addition to Qt.Key is included in 5.12.0: Ib5c37168990c9d9fa99fdd50f63b934c793e8dc
2020-11-04old qt: Use ApplicationAttribute to switch Ctrl/Meta on MacFlorian Bruhin
2020-11-04old qt: Remove KeyInfo.__hash__Florian Bruhin
2020-10-28mypy: use from-import style for typingTim Brown
Update files in `keyinput`, `mainwindow`, and `misc`. See #5396
2020-06-17modeparsers: Refactor how hints are handledFlorian Bruhin
Instead of binding hints to fake :follow-hint commands, we now use a separate CommandKeyParser and ask that for its match result. If the key matches with the command parser, it is bound in hint mode, so we clear the hint keystring and defer to the command handling instead. If it doesn't, we continue hint handling as usual - however, the HintKeyParser is now not a CommandKeyParser anymore, so we don't have to deal with command parsing (and have a custom execute implementation instead). Closes #4504 Fixes #4392 Fixes #4368 Helps with #5084, though it doesn't completely fix that yet. Supersedes #3742 (fix for #3735) Supersedes #4691 (fix for #4264)
2020-05-10mypy: Use explicit "type: ignore[...]" ignoresFlorian Bruhin
See #5368
2020-05-10mypy: Improve typing in keyutilsFlorian Bruhin
See #5368
2020-05-09mypy: Fix typing in keyutilsFlorian Bruhin
See #5368
2020-01-04Adjust copyrights for 2020Florian Bruhin
2019-10-09Complete type annotations for keyinput.keyutilsFlorian Bruhin
2019-10-06Use unicode escapes for combining charsFlorian Bruhin
Thanks to user202729 for the patch. Fixes #4491
2019-10-01pylint: Remove protected-access ignores in special methodsFlorian Bruhin
2019-09-12Use a constant for Qt.Key(0)Florian Bruhin
2019-09-12Improve docstringsFlorian Bruhin
2019-09-12Add some more type safety for keyutilsFlorian Bruhin
We now convert from int to Qt.Key as soon as we get a key (with no modifiers added) from a QKeyEvent. Also add missing _assert_plain_key calls.
2019-09-12Add more type annotations for keyinput.keyutilsFlorian Bruhin
2019-09-12Make KeyInfo hashableFlorian Bruhin
This way, we can store the real KeyInfo objects in BindingTrie instead of having to use .to_int().
2019-09-11Merge remote-tracking branch 'origin/pr/4691'Florian Bruhin
2019-09-11Fix lintFlorian Bruhin
2019-09-11Merge remote-tracking branch 'origin/pr/4492'Florian Bruhin
2019-09-10Merge remote-tracking branch 'origin/pr/4585'Florian Bruhin
2019-09-10Use dict literal directlyFlorian Bruhin
2019-09-10More special_names cleanupsFlorian Bruhin
2019-09-10Exclude coverage for AttributeErrorFlorian Bruhin
On Qt 5.13, all those keys are defined, so this line never gets hit. (For some reason, this wasn't a problem before moving _SPECIAL_NAMES out of the function it was in - not sure why...)
2019-09-10Complete type annotationFlorian Bruhin
2019-09-10Remove superfluous 'if'Florian Bruhin
Modules can only get imported once (in other words, imports are cached by Python).
2019-09-10Merge remote-tracking branch 'origin/pr/4536'Florian Bruhin
2019-08-18Fix implicit int conversions for QKeySequenceFlorian Bruhin
This also fixes some calls to utils.KeySequence with a string. See #4928
2019-03-31Prevent modifier keys from breaking hint mode keychainuser202729
Fixes #4264.
2019-03-31Make keyutils.is_special function do what it says in the docstringuser202729
This was broken in PR #3742.
2019-03-31Separate logic for checking special key and whether a key should clear hint ↵user202729
mode keychain