abouttreesummaryrefslogcommitdiff
path: root/srcs/juloo.keyboard2/KeyValue.java
diff options
context:
space:
mode:
authorJules Aguillon2023-08-20 00:44:22 +0200
committerJules Aguillon2023-08-20 00:44:22 +0200
commit40498e7b4cbd1b3e9e677f19d638638b6db3d2f9 (patch)
tree62bad31d98894b61baefebdbe3310c1b11a997c4 /srcs/juloo.keyboard2/KeyValue.java
parentcd5ca562266624b3abba1a4945a5fef9acc02fa0 (diff)
downloadunexpected-keyboard-40498e7b4cbd1b3e9e677f19d638638b6db3d2f9.tar.gz
unexpected-keyboard-40498e7b4cbd1b3e9e677f19d638638b6db3d2f9.zip
Refactor: Allow combining diacritics modifiers
Change the API of `KeyModifier.Map_char` to allow returning a string instead of a single 16 bits char. This allows to return combining diacritics. This also gets rid of `apply_map_or_dead_char`, maps can have their own fallback.
Diffstat (limited to 'srcs/juloo.keyboard2/KeyValue.java')
-rw-r--r--srcs/juloo.keyboard2/KeyValue.java17
1 files changed, 9 insertions, 8 deletions
diff --git a/srcs/juloo.keyboard2/KeyValue.java b/srcs/juloo.keyboard2/KeyValue.java
index 0972214..10ce481 100644
--- a/srcs/juloo.keyboard2/KeyValue.java
+++ b/srcs/juloo.keyboard2/KeyValue.java
@@ -182,11 +182,6 @@ final class KeyValue
return new KeyValue(String.valueOf(c), Kind.Char, c, getFlags());
}
- public KeyValue withString(String s)
- {
- return new KeyValue(s, Kind.String, 0, getFlags());
- }
-
public KeyValue withSymbol(String s)
{
return new KeyValue(s, (_code & KIND_BITS), (_code & VALUE_BITS), getFlags());
@@ -302,13 +297,19 @@ final class KeyValue
return new KeyValue("", Kind.Placeholder, id.ordinal(), 0);
}
- /** Make a key that types a string. */
public static KeyValue makeStringKey(String str)
{
+ return makeStringKey(str, 0);
+ }
+
+ /** Make a key that types a string. A char key is returned for a string of
+ length 1. */
+ public static KeyValue makeStringKey(String str, int flags)
+ {
if (str.length() == 1)
- return new KeyValue(str, Kind.Char, str.charAt(0), 0);
+ return new KeyValue(str, Kind.Char, str.charAt(0), flags);
else
- return new KeyValue(str, Kind.String, 0, FLAG_SMALLER_FONT);
+ return new KeyValue(str, Kind.String, 0, flags | FLAG_SMALLER_FONT);
}
public static KeyValue getKeyByName(String name)