From e9f734b6ccef1e827930aba8e9bf42acb4da1be2 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Mon, 12 Feb 2024 23:36:32 +0100 Subject: [PATCH] compose: Don't remove keys not in sequence Keys that are not part of any possible sequences are now dimmed and still usable instead of being removed, which felt weird. --- srcs/juloo.keyboard2/ComposeKey.java | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/srcs/juloo.keyboard2/ComposeKey.java b/srcs/juloo.keyboard2/ComposeKey.java index 173fcd7..4a8cff7 100644 --- a/srcs/juloo.keyboard2/ComposeKey.java +++ b/srcs/juloo.keyboard2/ComposeKey.java @@ -10,15 +10,22 @@ public final class ComposeKey { switch (kv.getKind()) { - case Char: return apply(state, kv.getChar()); + case Char: + KeyValue res = apply(state, kv.getChar()); + // Dim characters not part of any sequence instead of removing them. + if (res == null) + return kv.withFlags(kv.getFlags() | KeyValue.FLAG_SECONDARY); + return res; /* These keys must not be removed. */ - case Event: return kv; - case Modifier: return kv; + case Event: + case Modifier: + return kv; /* These keys cannot be part of sequences. */ - case String: return null; - case Keyevent: return null; - case Editing: return null; - case Placeholder: return null; + case String: + case Keyevent: + case Editing: + case Placeholder: + return kv.withFlags(kv.getFlags() | KeyValue.FLAG_SECONDARY); case Compose_pending: return null; } return null;