Ikcelaks / qmk_sequence_transform

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.
Apache License 2.0
6 stars 3 forks source link

Extended ascii trie/refactor/bugfixes #77

Closed kamih closed 7 months ago

kamih commented 7 months ago

Changes to the script:

  1. Removed now unneeded constants.
  2. Simplified generate_sequence_symbol_map.
  3. Utf8 seq tokens and wordbreak symbols are now added to generated header (with an #ifdef ST_TESTER so QMK doesn't complain about unused variables).
  4. Rule sequences and transforms are now both saved as triecode arrays to generated test header.

Changes to the code:

  1. Moved all triecode/keycode/ascii conversion functions into triecodes.h/c. Each has a narrow and specific job, and there is now no confusing duplication of code.
  2. Tester now uses key_stack (of triecodes) for simulated output. Triecodes are now compared directly instead of comparing after lossy string conversions. Test functions no longer have to know/care if they should ignore a leading space in the transform.
  3. Added new tester only functions to key_buffer/key_stack/triecodes wrapped in #ifdef ST_TESTER blocks so they don't get compiled into the firmware.
  4. Tester -s mode now shows input/output buffers with utf8 symbols.
  5. Updated copyright headers on all source files.

Bug fixed: st_perform was being called for key down and key up. I fixed it by moving the if (!record->event.pressed) test to right before we're about to work with the final keycode, since the body of st_process_check could potentially convert the incoming keycode into KC_BSPC. (While fixing this, I moved code into functions to make the main process_sequence_transform function more readable.)