Sequence-Transform is a user library for QMK that enables a rich declarative ruleset for transforming a sequence of keypresses into any output you would like.
To implement the enhanced backspace feature, we need to save a reference to the action taken for each keypress.
In preparation for that, I have enhanced the keybuffer to hold a struct for each keypress.
Additionally, I re-implemented the buffer as a rotating buffer, so now there are no memmoves required. They way our code works, after a word or two to prime the buffer, basically every keypress was triggering a memmove of the full buffer. That is no longer required. Probably not a huge performance gain, but it becomes more significant as the payload gets bigger (we might add more meta-data later) and the buffer gets larger (longer rules).
Finally, I reindexed everything to be more natural. Before, the most recent keypress lived at index -1, which twisted my brain out of me everytime I tried to reason about it. Now, the most recent key press is at index 0 and each increment ohf the index goes one key further back in the history. Since we essentially always want to start at the most recent key and step back into the past. that iteration will now by in the form of for (i=0; i < buf->context_len; i++) st_key_buffer_get_keycode(buf, i)
An important note is that the base depth of the trie is now 0 (not 1 or -1)
To implement the enhanced backspace feature, we need to save a reference to the action taken for each keypress.
In preparation for that, I have enhanced the keybuffer to hold a struct for each keypress.
Additionally, I re-implemented the buffer as a rotating buffer, so now there are no memmoves required. They way our code works, after a word or two to prime the buffer, basically every keypress was triggering a memmove of the full buffer. That is no longer required. Probably not a huge performance gain, but it becomes more significant as the payload gets bigger (we might add more meta-data later) and the buffer gets larger (longer rules).
Finally, I reindexed everything to be more natural. Before, the most recent keypress lived at index -1, which twisted my brain out of me everytime I tried to reason about it. Now, the most recent key press is at index 0 and each increment ohf the index goes one key further back in the history. Since we essentially always want to start at the most recent key and step back into the past. that iteration will now by in the form of
for (i=0; i < buf->context_len; i++) st_key_buffer_get_keycode(buf, i)
An important note is that the base depth of the trie is now
0
(not1
or-1
)