diff options
| author | Jules Aguillon | 2025-02-22 11:55:17 +0100 |
|---|---|---|
| committer | Jules Aguillon | 2025-03-01 16:52:46 +0100 |
| commit | 906755b787d2f4e7e13a1ba005c6cd360201dba7 (patch) | |
| tree | 2b64e5e7147d497d6ee4204eaae8a6f781846def /srcs/juloo.keyboard2/prefs | |
| parent | 80c52460c70d16e7d1f79dd45190747051e764a1 (diff) | |
| download | unexpected-keyboard-906755b787d2f4e7e13a1ba005c6cd360201dba7.tar.gz unexpected-keyboard-906755b787d2f4e7e13a1ba005c6cd360201dba7.zip | |
prefs: Add 'delete_word' and 'forward_delete_word' to extra keys
The gesture combination is mentioned. Preferred position are added.
Diffstat (limited to 'srcs/juloo.keyboard2/prefs')
| -rw-r--r-- | srcs/juloo.keyboard2/prefs/ExtraKeysPreference.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/srcs/juloo.keyboard2/prefs/ExtraKeysPreference.java b/srcs/juloo.keyboard2/prefs/ExtraKeysPreference.java index 981ba48..ae0ac0c 100644 --- a/srcs/juloo.keyboard2/prefs/ExtraKeysPreference.java +++ b/srcs/juloo.keyboard2/prefs/ExtraKeysPreference.java @@ -72,6 +72,8 @@ public class ExtraKeysPreference extends PreferenceCategory "pasteAsPlainText", "undo", "redo", + "delete_word", + "forward_delete_word", "superscript", "subscript", "f11_placeholder", @@ -177,6 +179,14 @@ public class ExtraKeysPreference extends PreferenceCategory id = R.string.key_descr_redo; additional_info = format_key_combination(new String[]{"fn", "undo"}); break; + case "delete_word": + id = R.string.key_descr_delete_word; + additional_info = format_key_combination_gesture(res, "backspace"); + break; + case "forward_delete_word": + id = R.string.key_descr_forward_delete_word; + additional_info = format_key_combination_gesture(res, "forward_delete"); + break; case "selectAll": id = R.string.key_descr_selectAll; break; case "shareText": id = R.string.key_descr_shareText; break; case "subscript": id = R.string.key_descr_subscript; break; @@ -276,6 +286,7 @@ public class ExtraKeysPreference extends PreferenceCategory return kv.getString(); } + /** Format a key combination */ static String format_key_combination(String[] keys) { StringBuilder out = new StringBuilder(); @@ -287,6 +298,13 @@ public class ExtraKeysPreference extends PreferenceCategory return out.toString(); } + /** Explain a gesture on a key */ + static String format_key_combination_gesture(Resources res, String key_name) + { + return res.getString(R.string.key_descr_gesture) + " + " + + KeyValue.getKeyByName(key_name).getString(); + } + static KeyboardData.PreferredPos key_preferred_pos(String key_name) { switch (key_name) @@ -341,6 +359,16 @@ public class ExtraKeysPreference extends PreferenceCategory new KeyboardData.KeyPos(0, -1, 3), new KeyboardData.KeyPos(0, -1, 4), }); + case "delete_word": + return new KeyboardData.PreferredPos(KeyValue.getKeyByName("backspace"), + new KeyboardData.KeyPos[]{ + new KeyboardData.KeyPos(-1, -1, 3), + }); + case "forward_delete_word": + return new KeyboardData.PreferredPos(KeyValue.getKeyByName("backspace"), + new KeyboardData.KeyPos[]{ + new KeyboardData.KeyPos(-1, -1, 4), + }); } return KeyboardData.PreferredPos.DEFAULT; } |
