summaryrefslogtreecommitdiff
path: root/users/drashna/keyrecords/autocorrection
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2022-01-21 19:36:52 -0800
committerGitHub <noreply@github.com>2022-01-21 19:36:52 -0800
commitb090ff03ed4391f27e8e3d9a843f529bedd08e19 (patch)
treee734aa4541f05ed4f919f86ff36d85cbd17f795a /users/drashna/keyrecords/autocorrection
parent8901c9eca1db8d10b06f544553a5fc941eda51ae (diff)
[Keymap] Drashna's OLED rewrite (#15981)
Diffstat (limited to 'users/drashna/keyrecords/autocorrection')
-rw-r--r--users/drashna/keyrecords/autocorrection/autocorrection.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/users/drashna/keyrecords/autocorrection/autocorrection.c b/users/drashna/keyrecords/autocorrection/autocorrection.c
index e561224374..c7e938a341 100644
--- a/users/drashna/keyrecords/autocorrection/autocorrection.c
+++ b/users/drashna/keyrecords/autocorrection/autocorrection.c
@@ -17,6 +17,14 @@
# error Dictionary size excees maximum size permitted
# endif
+/**
+ * @brief Process handler for autocorrect feature
+ *
+ * @param keycode Keycode registered by matrix press, per keymap
+ * @param record keyrecord_t structure
+ * @return true Continue processing keycodes, and send to host
+ * @return false Stop processing keycodes, and don't send to host
+ */
bool process_autocorrection(uint16_t keycode, keyrecord_t* record) {
static uint8_t typo_buffer[AUTOCORRECTION_MAX_LENGTH] = {KC_SPC};
static uint8_t typo_buffer_size = 1;
@@ -53,6 +61,14 @@ bool process_autocorrection(uint16_t keycode, keyrecord_t* record) {
keycode &= 0xFF;
break;
# endif
+# ifdef SWAP_HANDS_ENABLE
+ case QK_SWAP_HANDS ... QK_SWAP_HANDS_MAX:
+ if (keycode >= 0x56F0 || record->event.pressed || !record->tap.count) {
+ return true;
+ }
+ keycode &= 0xFF;
+ break;
+# endif
# ifndef NO_ACTION_ONESHOT
case QK_ONE_SHOT_MOD ... QK_ONE_SHOT_MOD_MAX:
if ((keycode & 0xF) == MOD_LSFT) {
@@ -70,7 +86,6 @@ bool process_autocorrection(uint16_t keycode, keyrecord_t* record) {
}
}
-
// Subtract buffer for Backspace key, reset for other non-alpha.
if (!(KC_A <= keycode && keycode <= KC_Z)) {
if (keycode == KC_BSPC) {
@@ -83,7 +98,7 @@ bool process_autocorrection(uint16_t keycode, keyrecord_t* record) {
// Set a word boundary if space, period, digit, etc. is pressed.
// Behave more conservatively for the enter key. Reset, so that enter
// can't be used on a word ending.
- if (keycode == KC_ENT) {
+ if (keycode == KC_ENT || (keycode == KC_MINUS && (get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT)) {
typo_buffer_size = 0;
}
keycode = KC_SPC;