diff --git a/quantum/process_keycode/process_ucis.c b/quantum/process_keycode/process_ucis.c index 91a038bab1cd..9417e1226370 100644 --- a/quantum/process_keycode/process_ucis.c +++ b/quantum/process_keycode/process_ucis.c @@ -36,6 +36,8 @@ bool process_ucis(uint16_t keycode, keyrecord_t *record) { case KC_ENTER: ucis_finish(); return false; + default: + return false; } } } diff --git a/quantum/unicode/ucis.c b/quantum/unicode/ucis.c index 32be78520654..58cf927d7765 100644 --- a/quantum/unicode/ucis.c +++ b/quantum/unicode/ucis.c @@ -37,15 +37,19 @@ static char keycode_to_char(uint16_t keycode) { bool ucis_add(uint16_t keycode) { char c = keycode_to_char(keycode); - if (c) { - input[count++] = c; - return true; + if (count < UCIS_MAX_INPUT_LENGTH - 1) { + if (c) { + input[count++] = c; + input[count] = 0; + return true; + } } return false; } bool ucis_remove_last(void) { if (count) { + input[count] = 0; count--; return true; } @@ -72,10 +76,11 @@ void ucis_finish(void) { } } + for (uint8_t j = 0; j <= count; j++) { + tap_code(KC_BACKSPACE); + } + if (found) { - for (uint8_t j = 0; j <= count; j++) { - tap_code(KC_BACKSPACE); - } register_ucis(i); } @@ -83,6 +88,10 @@ void ucis_finish(void) { } void ucis_cancel(void) { + for (uint8_t i = 0; i <= count; i++) { + tap_code(KC_BACKSPACE); + } + count = 0; active = false; }