From e9ff66d8ad341917ff270c9f33b83d86fe0fb6c4 Mon Sep 17 00:00:00 2001 From: Chris Salch Date: Fri, 7 Jul 2023 06:52:24 -0500 Subject: [PATCH] Adds a way to separate tab from AUTO_SHIFT_SPECIAL. (#20996) --- docs/feature_auto_shift.md | 47 ++++++++++++++++++-- quantum/process_keycode/process_auto_shift.c | 10 ++++- quantum/process_keycode/process_auto_shift.h | 8 +++- 3 files changed, 58 insertions(+), 7 deletions(-) diff --git a/docs/feature_auto_shift.md b/docs/feature_auto_shift.md index 1719807e26..6241cbaeb1 100644 --- a/docs/feature_auto_shift.md +++ b/docs/feature_auto_shift.md @@ -133,7 +133,17 @@ groups in the below fallback switch. ### NO_AUTO_SHIFT_SPECIAL (simple define) Do not Auto Shift special keys, which include -\_, =+, [{, ]}, ;:, '", ,<, .>, -and /? +/?, and the KC_TAB. + +### NO_AUTO_SHIFT_TAB (simple define) + +Do not Auto Shift KC_TAB but leave Auto Shift enabled for the other special +characters. + +### NO_AUTO_SHIFT_SYMBOLS (simple define) + +Do not Auto Shift symbol keys, which include -\_, =+, [{, ]}, ;:, '", ,<, .>, +and /?. ### NO_AUTO_SHIFT_NUMERIC (simple define) @@ -143,9 +153,13 @@ Do not Auto Shift numeric keys, zero through nine. Do not Auto Shift alpha characters, which include A through Z. +### AUTO_SHIFT_ENTER (simple define) + +Auto Shift the enter key. + ### Auto Shift Per Key -There are functions that allows you to determine which keys shold be autoshifted, much like the tap-hold keys. +There are functions that allows you to determine which keys should be autoshifted, much like the tap-hold keys. The first of these, used to simply add a key to Auto Shift, is `get_custom_auto_shifted_key`: @@ -172,9 +186,15 @@ bool get_auto_shifted_key(uint16_t keycode, keyrecord_t *record) { case KC_1 ... KC_0: # endif # ifndef NO_AUTO_SHIFT_SPECIAL +# ifndef NO_AUTO_SHIFT_TAB case KC_TAB: - case KC_MINUS ... KC_SLASH: - case KC_NONUS_BACKSLASH: +# endif +# ifndef NO_AUTO_SHIFT_SYMBOLS + case AUTO_SHIFT_SYMBOLS: +# endif +# endif +# ifdef AUTO_SHIFT_ENTER + case KC_ENT: # endif return true; } @@ -192,6 +212,25 @@ Enables keyrepeat. Disables automatically keyrepeating when `AUTO_SHIFT_TIMEOUT` is exceeded. + +### AUTO_SHIFT_ALPHA (predefined key group) + +A predefined group of keys representing A through Z. + +### AUTO_SHIFT_NUMERIC (predefined key group) + +A predefined group of keys representing 0 through 9. Note, these are defined as +1 through 0 since that is the order they normally appear in. + +### AUTO_SHIFT_SYMBOLS (predefined key group) + +A predefined group of keys representing symbolic characters which include -\_, =+, [{, ]}, ;:, '", ,<, .>, +and /?. + +### AUTO_SHIFT_SPECIAL (predefined key group) + +A predefined group of keys that combines AUTO_SHIFT_SYMBOLS and KC_TAB. + ## Custom Shifted Values Especially on small keyboards, the default shifted value for many keys is not diff --git a/quantum/process_keycode/process_auto_shift.c b/quantum/process_keycode/process_auto_shift.c index 62c347ae0c..63e893fc18 100644 --- a/quantum/process_keycode/process_auto_shift.c +++ b/quantum/process_keycode/process_auto_shift.c @@ -75,7 +75,15 @@ __attribute__((weak)) bool get_auto_shifted_key(uint16_t keycode, keyrecord_t *r case AUTO_SHIFT_NUMERIC: # endif # ifndef NO_AUTO_SHIFT_SPECIAL - case AUTO_SHIFT_SPECIAL: +# ifndef NO_AUTO_SHIFT_TAB + case KC_TAB: +# endif +# ifndef NO_AUTO_SHIFT_SYMBOLS + case AUTO_SHIFT_SYMBOLS: +# endif +# endif +# ifdef AUTO_SHIFT_ENTER + case KC_ENT: # endif return true; } diff --git a/quantum/process_keycode/process_auto_shift.h b/quantum/process_keycode/process_auto_shift.h index 66a4b3138a..780177d2ff 100644 --- a/quantum/process_keycode/process_auto_shift.h +++ b/quantum/process_keycode/process_auto_shift.h @@ -28,10 +28,14 @@ // clang-format off #define AUTO_SHIFT_ALPHA KC_A ... KC_Z #define AUTO_SHIFT_NUMERIC KC_1 ... KC_0 +#define AUTO_SHIFT_SYMBOLS \ + KC_MINUS ... KC_SLASH: \ + case KC_NONUS_BACKSLASH + +// Kept to avoid breaking existing keymaps. #define AUTO_SHIFT_SPECIAL \ KC_TAB: \ - case KC_MINUS ... KC_SLASH: \ - case KC_NONUS_BACKSLASH + case AUTO_SHIFT_SYMBOLS // clang-format on bool process_auto_shift(uint16_t keycode, keyrecord_t *record);