iina
iina copied to clipboard
Multiple fixes to key binding parsing
- [ ] This change has been discussed with the author.
- [x] It implements / fixes issues: #3831 #3881 #3851
Description: This patch is a subset of (and is actually back-ported from) #3847, and contains only the changes to parsing and mapping key bindings. It is the successor to #3833: it fixes a loophole in that logic which result in unused duplicate entries being stored, while also adding other fixes which couldn't be merged separately.
It does the following
- Splits
KeyMapping
'skey
field into rawKey andnormalizedMpvKey
, similar to how itsaction
field has raw & parsed version. - Moves the existing mpv normalization logic out of the
KeyMapping
constructor and intoKeyCodeHelper
. - Expands the mpv normalization logic to ensure that in normal form (fixes #3851):
- Special key symbols are capitalized
- A key's uppercase symbol is used if it is available, instead of containing "Shift+"
- Key sequences containing the
-
(minus) key are properly parsed
- Use normal form always when identifying key bindings; use raw form when editing in the UI, to ensure consistent functionality while keeping a smooth user experience
- Add check for ignoring the line
default-bindings begin
, rather than binding it to a ke - Add check for
{section_name}
(section name in curly braces): if it is "default" then strip the section and include the binding; for other section names do not include the binding (fixes #3881)