Skip to content

Commit

Permalink
fix: theme preset trime combination keys not working
Browse files Browse the repository at this point in the history
  • Loading branch information
if-can authored and Bambooin committed Jan 9, 2025
1 parent 7972858 commit c42b500
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/src/main/java/com/osfans/trime/ime/keyboard/KeyAction.kt
Original file line number Diff line number Diff line change
Expand Up @@ -92,22 +92,26 @@ 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)
if (action.isNotEmpty()) {
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)) {
Expand Down

0 comments on commit c42b500

Please sign in to comment.