From 73b0f54093e878106da09a890ca183ab55102f4b Mon Sep 17 00:00:00 2001 From: teatov Date: Thu, 31 Jul 2025 10:10:48 +1000 Subject: [PATCH] make `chars_to_dict` omit empty chars --- scripts/key_props.gd | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/scripts/key_props.gd b/scripts/key_props.gd index 99bb14b..f82b2bd 100644 --- a/scripts/key_props.gd +++ b/scripts/key_props.gd @@ -94,9 +94,14 @@ func chars_from_dict(dict: Dictionary[Char, String], override: bool = true) -> K func chars_to_dict() -> Dictionary[Char, String]: - return { - Char.MAIN: main_char, - Char.SHIFT: shift_char, - Char.ALT: alt_char, - Char.ALT_SHIFT: alt_shift_char, - } + var dict: Dictionary[Char, String] = {} + if main_char: + dict[Char.MAIN] = main_char + if shift_char: + dict[Char.SHIFT] = shift_char + if alt_char: + dict[Char.ALT] = alt_char + if alt_shift_char: + dict[Char.ALT_SHIFT] = alt_shift_char + + return dict