Fix T84549: Keymap presets written without repeat enabled

Key map items using TEXTINPUT didn't include the repeat setting.
This commit is contained in:
Campbell Barton 2021-01-14 20:52:36 +11:00
parent a4226a050b
commit 024ac9c089
Notes: blender-bot 2023-02-13 19:56:48 +01:00
Referenced by issue #84549, Custom keymap cloned from IC - holding down key does not fill a line in text editor anymore
1 changed files with 5 additions and 3 deletions

View File

@ -74,9 +74,11 @@ def kmi_args_as_data(kmi):
s.append(f"\"key_modifier\": '{kmi.key_modifier}'")
if kmi.repeat:
if kmi.map_type == 'KEYBOARD':
if kmi.value in {'PRESS', 'ANY'}:
s.append("\"repeat\": True")
if (
(kmi.map_type == 'KEYBOARD' and kmi.value in {'PRESS', 'ANY'}) or
(kmi.map_type == 'TEXTINPUT')
):
s.append("\"repeat\": True")
return "{" + ", ".join(s) + "}"