diff --git a/srcs/juloo.keyboard2/Config.java b/srcs/juloo.keyboard2/Config.java index 8a81556..24565ab 100644 --- a/srcs/juloo.keyboard2/Config.java +++ b/srcs/juloo.keyboard2/Config.java @@ -182,6 +182,8 @@ final class Config // first iteration then automatically added. final Set extra_keys = new HashSet(); final Set remove_keys = new HashSet(); + extra_keys.addAll(extra_keys_param); + extra_keys.addAll(extra_keys_custom); if (extra_keys_subtype != null) { Set present = new HashSet(); @@ -191,8 +193,6 @@ final class Config extra_keys_subtype.compute(extra_keys, new ExtraKeys.Query(kw.script, present)); } - extra_keys.addAll(extra_keys_param); - extra_keys.addAll(extra_keys_custom); boolean number_row = this.number_row && !show_numpad; if (number_row) KeyboardData.number_row.getKeys(remove_keys); 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