abouttreesummaryrefslogcommitdiff
diff options
context:
space:
mode:
authorJules Aguillon2024-12-17 11:27:09 +0100
committerJules Aguillon2024-12-19 00:59:27 +0100
commit82e472ba469c44272e6e3cfd5b9e047a7121ef68 (patch)
treee416a7d597361e04f560c1d5516bb24970d76332
parentbd2170e04b58d9aed80ef4871daa23e6490c115a (diff)
downloadunexpected-keyboard-82e472ba469c44272e6e3cfd5b9e047a7121ef68.tar.gz
unexpected-keyboard-82e472ba469c44272e6e3cfd5b9e047a7121ef68.zip
Compose: Allow to force string final states
Appending the ':' character to a sequence result forces it to be a string final state. This will cause a KeyValue lookup that would normally not happen for single-character results. This is useful to make Tamil letters smaller, even when they are the result of a Shift.
-rw-r--r--srcs/compose/compile.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/srcs/compose/compile.py b/srcs/compose/compile.py
index e8feba3..d64a630 100644
--- a/srcs/compose/compile.py
+++ b/srcs/compose/compile.py
@@ -195,6 +195,9 @@ def make_automata(tries):
# There are two encoding for leafs: character final state for 15-bit
# characters and string final state for the rest.
if len(c) > 1 or ord(c[0]) > 32767: # String final state
+ # A ':' can be added to the result of a sequence to force a string
+ # final state. For example, to go through KeyValue lookup.
+ if c.startswith(":"): c = c[1:]
javachars = array('H', c.encode("UTF-16-LE"))
states.append((-1, len(javachars) + 1))
for c in javachars: