diff --git a/srcs/juloo.keyboard2/ComposeKey.java b/srcs/juloo.keyboard2/ComposeKey.java index 9a4d399..6e0094d 100644 --- a/srcs/juloo.keyboard2/ComposeKey.java +++ b/srcs/juloo.keyboard2/ComposeKey.java @@ -15,10 +15,12 @@ public final class ComposeKey if (res == null) return kv.withFlags(kv.getFlags() | KeyValue.FLAG_GREYED); return res; + /* Tapping compose again exits the pending sequence. */ + case Compose_pending: + return KeyValue.nothingKey(kv); /* These keys are not greyed. */ case Event: case Modifier: - case Compose_pending: return kv; /* Other keys cannot be part of sequences. */ default: diff --git a/srcs/juloo.keyboard2/KeyValue.java b/srcs/juloo.keyboard2/KeyValue.java index fea03fa..540138b 100644 --- a/srcs/juloo.keyboard2/KeyValue.java +++ b/srcs/juloo.keyboard2/KeyValue.java @@ -80,6 +80,7 @@ public final class KeyValue implements Comparable public static enum Placeholder { REMOVED, + NOTHING, F11, F12, SHINDOT, @@ -380,6 +381,16 @@ public final class KeyValue implements Comparable return new KeyValue("", Kind.Placeholder, id.ordinal(), 0); } + /** Make a key that does nothing, inheriting the symbol from an other key. */ + public static KeyValue nothingKey(KeyValue inherit) + { + // Keep only appearance flags + int flags = inherit.getFlags() & (FLAG_SPECIAL | FLAG_GREYED | + FLAG_KEY_FONT | FLAG_SMALLER_FONT | FLAG_SECONDARY); + return new KeyValue(inherit.getString(), Kind.Placeholder, + Placeholder.NOTHING.ordinal(), flags); + } + public static KeyValue makeStringKey(String str) { return makeStringKey(str, 0);