abouttreesummaryrefslogcommitdiff
path: root/srcs/juloo.keyboard2/ComposeKey.java
diff options
context:
space:
mode:
authorJules Aguillon2024-06-09 10:35:38 +0200
committerJules Aguillon2024-06-09 10:35:38 +0200
commita886f6eedeafbe06c6de0cf68fbd0f81655af597 (patch)
tree012ed3fa9f4b2e0ed171ce92bf98a58aff877eb0 /srcs/juloo.keyboard2/ComposeKey.java
parent1197ce36b4b6f67ab7343a6dc4f2258b52b73358 (diff)
downloadunexpected-keyboard-a886f6eedeafbe06c6de0cf68fbd0f81655af597.tar.gz
unexpected-keyboard-a886f6eedeafbe06c6de0cf68fbd0f81655af597.zip
compose: Fix misbehaving due to encoding errors
Encoding errors in the compose data compiler due to: - 'UTF-16' adds a BOM, use 'UTF-16-LE' instead - 'str.encode' returns a byte array, use 'array' to have a 16-bit char array.
Diffstat (limited to 'srcs/juloo.keyboard2/ComposeKey.java')
-rw-r--r--srcs/juloo.keyboard2/ComposeKey.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/srcs/juloo.keyboard2/ComposeKey.java b/srcs/juloo.keyboard2/ComposeKey.java
index 328bb83..9272bd0 100644
--- a/srcs/juloo.keyboard2/ComposeKey.java
+++ b/srcs/juloo.keyboard2/ComposeKey.java
@@ -36,17 +36,17 @@ public final class ComposeKey
if (next < 0)
return null;
next = edges[next];
- char next_header = states[next];
+ int next_header = states[next];
if (next_header == 0) // Enter a new intermediate state.
return KeyValue.makeComposePending(String.valueOf(c), next, 0);
- else if (next_header > 0) // Character final state.
- return KeyValue.makeCharKey(next_header);
- else // next_header is < 0, string final state.
+ else if (next_header == 0xFFFF) // String final state
{
int next_length = edges[next];
return KeyValue.makeStringKey(
- new String(states, next + 1, next + next_length));
+ new String(states, next + 1, next_length - 1));
}
+ else // Character final state.
+ return KeyValue.makeCharKey((char)next_header);
}
/** The state machine is comprised of two arrays.