Add combining 'accent_arrow_right'

It's the first modifier that uses combining diacritics. Whether it
should be represented as a modifier or a new kind of key can be
reconsidered later.
This commit is contained in:
Jules Aguillon
2022-06-05 13:51:09 +02:00
parent e4e54628b7
commit 02124dd71f
4 changed files with 32 additions and 1 deletions
+15 -1
View File
@@ -64,6 +64,7 @@ class KeyModifier
return maybe_modify_char(k, map_char_box(k.char_));
case KeyValue.MOD_SLASH:
return maybe_modify_char(k, map_char_slash(k.char_));
case KeyValue.MOD_ARROW_RIGHT: return apply_combining(k, "\u20D7");
default: return k;
}
}
@@ -76,11 +77,24 @@ class KeyModifier
return maybe_modify_char(k, c);
}
private static KeyValue apply_combining(KeyValue k, String combining)
{
if (k.char_ == KeyValue.CHAR_NONE)
return k;
return KeyValue.getKeyByName(String.valueOf(k.char_) + combining);
}
private static KeyValue apply_shift(KeyValue k)
{
char c = k.char_;
if (c == KeyValue.CHAR_NONE)
return k;
{
// The key is a string
if (k.code == KeyValue.EVENT_NONE)
return k.withCharAndSymbol(k.symbol.toUpperCase(), KeyValue.CHAR_NONE);
else
return k;
}
c = map_char_shift(c);
if (c == k.char_)
c = Character.toUpperCase(c);