From 4d10556d4904086664f14ac3b900e65505a19fe7 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Sun, 6 Aug 2023 17:11:29 +0200 Subject: Don't replace user selected dead keys Don't replace dead-keys selected in the "Add keys to the keyboard" option by an alternative. --- srcs/juloo.keyboard2/ExtraKeys.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'srcs/juloo.keyboard2/ExtraKeys.java') diff --git a/srcs/juloo.keyboard2/ExtraKeys.java b/srcs/juloo.keyboard2/ExtraKeys.java index fb1f3e2..cfac362 100644 --- a/srcs/juloo.keyboard2/ExtraKeys.java +++ b/srcs/juloo.keyboard2/ExtraKeys.java @@ -20,7 +20,8 @@ class ExtraKeys _ks = ks; } - /** Add the keys that should be added to the keyboard into [dst]. */ + /** Add the keys that should be added to the keyboard into [dst]. Keys + already added to [dst] might have an impact, see [ExtraKey.compute]. */ public void compute(Set dst, Query q) { for (ExtraKey k : _ks) @@ -77,11 +78,13 @@ class ExtraKeys // enforced to be complete by the merging step. The same [kv] will not // appear again in the list of extra keys with a different list of // alternatives. - KeyValue k = (alternatives.size() == 1) ? alternatives.get(0) : kv; + // Selecting the dead key in the "Add key to the keyboard" option would + // disable this behavior for a key. + boolean use_alternative = (alternatives.size() == 1 && !dst.contains(kv)); if ((q.script == null || script == null || q.script.equals(script)) && (alternatives.size() == 0 || !q.present.containsAll(alternatives))) - dst.add(k); + dst.add(use_alternative ? alternatives.get(0) : kv); } /** Return a new key from two. [kv] are expected to be equal. [script] is -- cgit v1.2.3