From c42b500a5aafd3101da175cdffa8207f62247870 Mon Sep 17 00:00:00 2001 From: if-can Date: Wed, 8 Jan 2025 20:27:56 +0800 Subject: [PATCH] fix: theme preset trime combination keys not working --- .../main/java/com/osfans/trime/ime/keyboard/KeyAction.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/osfans/trime/ime/keyboard/KeyAction.kt b/app/src/main/java/com/osfans/trime/ime/keyboard/KeyAction.kt index cdce3c78f5..126f91b1e0 100644 --- a/app/src/main/java/com/osfans/trime/ime/keyboard/KeyAction.kt +++ b/app/src/main/java/com/osfans/trime/ime/keyboard/KeyAction.kt @@ -92,12 +92,14 @@ class KeyAction( init { val unbraced = raw.removeSurrounding("{", "}") + var handled = false // match like: { x: "{Control+a}" } if (raw.matches(BRACED_STR)) { val (c, m) = Keycode.parseSend(unbraced) if (c != KeyEvent.KEYCODE_UNKNOWN || m > 0) { code = c modifier = m + handled = true } else { // match: { x: { commit: a, text: b, label: c } } val action = decodeMapFromString(raw) @@ -105,9 +107,11 @@ class KeyAction( commit = action["commit"] ?: "" text = action["text"] ?: "" label = action["label"] ?: "" + handled = true } } - } else { + } + if (!handled) { val theme = ThemeManager.activeTheme // match like: { x: BackSpace } -> preset_keys/BackSpace: {..., send: BackSpace } if (theme.presetKeys!!.containsKey(unbraced)) {