]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
process_unicode: Handle too long UCIS symbol names
authorGergely Nagy <algernon@madhouse-project.org>
Sat, 13 Aug 2016 09:11:22 +0000 (11:11 +0200)
committerGergely Nagy <algernon@madhouse-project.org>
Mon, 15 Aug 2016 08:08:53 +0000 (10:08 +0200)
If the symbol name being entered is longer than the max, stop recording
it, and stop processing keycodes apart from the ones that can delete,
finish or cancel the sequence.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
quantum/process_keycode/process_unicode.c

index 8a650930080b64ca06482614039bf2a06e4bed85..851a96eaabc1ce82c26b8bd7402aa089f0fef4b3 100644 (file)
@@ -110,7 +110,15 @@ void qk_ucis_symbol_fallback (void) {
 bool process_record_ucis (uint16_t keycode, keyrecord_t *record) {
   uint8_t i;
 
-  if (!qk_ucis_state.in_progress || !record->event.pressed)
+  if (!qk_ucis_state.in_progress)
+    return true;
+
+  if (qk_ucis_state.count >= UCIS_MAX_SYMBOL_LENGTH &&
+      !(keycode == KC_BSPC || keycode == KC_ESC || keycode == KC_SPC || keycode == KC_ENT)) {
+    return false;
+  }
+
+  if (!record->event.pressed)
     return true;
 
   qk_ucis_state.codes[qk_ucis_state.count] = keycode;