Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normalise Autocorrect keycodes #18893

Merged
merged 1 commit into from
Oct 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions docs/feature_autocorrect.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ AUTOCORRECT_ENABLE = yes

Additionally, you will need a library for autocorrection. A small sample library is included by default, so that you can get up and running right away, but you can provide a customized library.

By default, autocorrect is disabled. To enable it, you need to use the `AUTOCORRECT_TOGGLE` keycode to enable it. The status is stored in persistent memory, so you shouldn't need to enabled it again.
By default, autocorrect is disabled. To enable it, you need to use the `AC_TOGG` keycode to enable it. The status is stored in persistent memory, so you shouldn't need to enabled it again.

## Customizing autocorrect library :id=customizing-autocorrect-library

Expand Down Expand Up @@ -94,15 +94,15 @@ Occasionally you might actually want to type a typo (for instance, while editing

This works because the autocorrection implementation doesn’t understand hotkeys, so it resets itself whenever a modifier other than shift is held.

Additionally, you can use the `AUTOCORRECT_TOGGLE` keycode to toggle the on/off status for Autocorrect.
Additionally, you can use the `AC_TOGG` keycode to toggle the on/off status for Autocorrect.

### Keycodes :id=keycodes

|Keycode | Short keycode | Description |
|---------------------|---------------|------------------------------------------------|
|`AUTOCORRECT_ON` | `CRT_ON` | Turns on the Autocorrect feature. |
|`AUTOCORRECT_OFF` | `CRT_OFF` | Turns off the Autocorrect feature. |
|`AUTOCORRECT_TOGGLE` | `CRT_TOG` | Toggles the status of the Autocorrect feature. |
|Keycode |Aliases |Description |
|-----------------------|---------|----------------------------------------------|
|`QK_AUTOCORRECT_ON` |`AC_ON` |Turns on the Autocorrect feature. |
|`QK_AUTOCORRECT_OFF` |`AC_OFF` |Turns off the Autocorrect feature. |
|`QK_AUTOCORRECT_TOGGLE`|`AC_TOGG`|Toggles the status of the Autocorrect feature.|

## User Callback Functions

Expand Down
10 changes: 10 additions & 0 deletions docs/keycodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,16 @@ See also: [Audio](feature_audio.md)
|`MU_TOG` | |Toggles Music Mode |
|`MU_MOD` | |Cycles through the music modes |

## Autocorrect :id=autocorrect

See also: [Autocorrect](feature_autocorrect.md)

|Key |Aliases |Description |
|-----------------------|---------|----------------------------------------------|
|`QK_AUTOCORRECT_ON` |`AC_ON` |Turns on the Autocorrect feature. |
|`QK_AUTOCORRECT_OFF` |`AC_OFF` |Turns off the Autocorrect feature. |
|`QK_AUTOCORRECT_TOGGLE`|`AC_TOGG`|Toggles the status of the Autocorrect feature.|

## Backlighting :id=backlighting

See also: [Backlighting](feature_backlight.md)
Expand Down
8 changes: 4 additions & 4 deletions quantum/process_keycode/process_autocorrect.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,12 @@ bool process_autocorrect(uint16_t keycode, keyrecord_t *record) {
mods |= get_oneshot_mods();
#endif

if ((keycode >= AUTOCORRECT_ON && keycode <= AUTOCORRECT_TOGGLE) && record->event.pressed) {
if (keycode == AUTOCORRECT_ON) {
if ((keycode >= QK_AUTOCORRECT_ON && keycode <= QK_AUTOCORRECT_TOGGLE) && record->event.pressed) {
if (keycode == QK_AUTOCORRECT_ON) {
autocorrect_enable();
} else if (keycode == AUTOCORRECT_OFF) {
} else if (keycode == QK_AUTOCORRECT_OFF) {
autocorrect_disable();
} else if (keycode == AUTOCORRECT_TOGGLE) {
} else if (keycode == QK_AUTOCORRECT_TOGGLE) {
autocorrect_toggle();
} else {
return true;
Expand Down
12 changes: 6 additions & 6 deletions quantum/quantum_keycodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -611,9 +611,9 @@ enum quantum_keycodes {

UNICODE_MODE_EMACS,

AUTOCORRECT_ON,
AUTOCORRECT_OFF,
AUTOCORRECT_TOGGLE,
QK_AUTOCORRECT_ON,
QK_AUTOCORRECT_OFF,
QK_AUTOCORRECT_TOGGLE,

MAGIC_TOGGLE_BACKSLASH_BACKSPACE,

Expand Down Expand Up @@ -740,9 +740,9 @@ enum quantum_keycodes {
#define EH_LEFT MAGIC_EE_HANDS_LEFT
#define EH_RGHT MAGIC_EE_HANDS_RIGHT

#define CRT_ON AUTOCORRECT_ON
#define CRT_OFF AUTOCORRECT_OFF
#define CRT_TOG AUTOCORRECT_TOGGLE
#define AC_ON QK_AUTOCORRECT_ON
#define AC_OFF QK_AUTOCORRECT_OFF
#define AC_TOGG QK_AUTOCORRECT_TOGGLE

// Velocikey
#define VK_TOGG QK_VELOCIKEY_TOGGLE
Expand Down
2 changes: 1 addition & 1 deletion users/drashna/keyrecords/process_records.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ bool process_record_unicode(uint16_t keycode, keyrecord_t *record);

#define MG_NKRO MAGIC_TOGGLE_NKRO

#define AUTO_CTN AUTOCORRECT_TOGGLE
#define AUTO_CTN QK_AUTOCORRECT_TOGGLE
/*
Custom Keycodes for Diablo 3 layer
But since TD() doesn't work when tap dance is disabled
Expand Down