Reallocate user/kb keycode ranges (#19907)
This commit is contained in:
parent
961f0b7b2d
commit
9f2cd9119f
5 changed files with 82 additions and 69 deletions
|
@ -107,6 +107,7 @@ def deep_update(origdict, newdict):
|
|||
def merge_ordered_dicts(dicts):
|
||||
"""Merges nested OrderedDict objects resulting from reading a hjson file.
|
||||
Later input dicts overrides earlier dicts for plain values.
|
||||
If any value is "!delete!", the existing value will be removed from its parent.
|
||||
Arrays will be appended. If the first entry of an array is "!reset!", the contents of the array will be cleared and replaced with RHS.
|
||||
Dictionaries will be recursively merged. If any entry is "!reset!", the contents of the dictionary will be cleared and replaced with RHS.
|
||||
"""
|
||||
|
@ -125,6 +126,8 @@ def merge_ordered_dicts(dicts):
|
|||
target[k] = v[1:]
|
||||
else:
|
||||
target[k] = target[k] + v
|
||||
elif v == "!delete!" and isinstance(target, (OrderedDict, dict)):
|
||||
del target[k]
|
||||
else:
|
||||
target[k] = v
|
||||
|
||||
|
|
|
@ -90,6 +90,7 @@ def load_spec(version, lang=None):
|
|||
|
||||
# Sort?
|
||||
spec['keycodes'] = dict(sorted(spec.get('keycodes', {}).items()))
|
||||
spec['ranges'] = dict(sorted(spec.get('ranges', {}).items()))
|
||||
|
||||
# Validate?
|
||||
_validate(spec)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue