diff options
author | lokher <lokher@gmail.com> | 2023-04-26 16:32:15 +0800 |
---|---|---|
committer | lokher <lokher@gmail.com> | 2023-04-26 16:32:15 +0800 |
commit | e4f4ceaf3f2e3d25fb282273a81f9b58790fc427 (patch) | |
tree | c0a257eab0ffe5238fdf2c04882e8ee1fe8fc46e /docs/feature_autocorrect.md | |
parent | 103badc87cb50db1ff3851c84331e86ba78fb681 (diff) |
merge upstream 713427c
Diffstat (limited to 'docs/feature_autocorrect.md')
-rw-r--r-- | docs/feature_autocorrect.md | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/docs/feature_autocorrect.md b/docs/feature_autocorrect.md index e042027c0f..9f80c93f82 100644 --- a/docs/feature_autocorrect.md +++ b/docs/feature_autocorrect.md @@ -86,7 +86,7 @@ The `qmk generate-autocorrect-data` commands can make an effort to check for ent ## Overriding Autocorrect -Occasionally you might actually want to type a typo (for instance, while editing autocorrection_dict.txt) without being autocorrected. There are a couple of ways to do this: +Occasionally you might actually want to type a typo (for instance, while editing autocorrect_dict.txt) without being autocorrected. There are a couple of ways to do this: 1. Begin typing the typo. 2. Before typing the last letter, press and release the Ctrl or Alt key. @@ -236,15 +236,27 @@ bool apply_autocorrect(uint8_t backspaces, const char *str) { } ``` +### Autocorrect Status + +Additional user callback functions to manipulate Autocorrect: + +| Function | Description | +|----------------------------|----------------------------------------------| +| `autocorrect_enable()` | Turns Autocorrect on. | +| `autocorrect_disable()` | Turns Autocorrect off. | +| `autocorrect_toggle()` | Toggles Autocorrect. | +| `autocorrect_is_enabled()` | Returns true if Autocorrect is currently on. | + + ## Appendix: Trie binary data format :id=appendix -This section details how the trie is serialized to byte data in autocorrection_data. You don’t need to care about this to use this autocorrection implementation. But it is documented for the record in case anyone is interested in modifying the implementation, or just curious how it works. +This section details how the trie is serialized to byte data in autocorrect_data. You don’t need to care about this to use this autocorrection implementation. But it is documented for the record in case anyone is interested in modifying the implementation, or just curious how it works. What I did here is fairly arbitrary, but it is simple to decode and gets the job done. ### Encoding :id=encoding -All autocorrection data is stored in a single flat array autocorrection_data. Each trie node is associated with a byte offset into this array, where data for that node is encoded, beginning with root at offset 0. There are three kinds of nodes. The highest two bits of the first byte of the node indicate what kind: +All autocorrection data is stored in a single flat array autocorrect_data. Each trie node is associated with a byte offset into this array, where data for that node is encoded, beginning with root at offset 0. There are three kinds of nodes. The highest two bits of the first byte of the node indicate what kind: * 00 ⇒ chain node: a trie node with a single child. * 01 ⇒ branching node: a trie node with multiple children. |