Improved spellcheck sending

This commit is contained in:
2022-07-21 21:20:16 -07:00
parent c757a1686c
commit bf6faeb94f
5 changed files with 28 additions and 14 deletions

View File

@ -5,6 +5,7 @@
#include "features/spellcheck.h"
#include "features/beta_rawhid.h"
#include "extra_mappings.h"
uint8_t spellcheck_buffer[SPELLCHECK_BUFFER_MAX] = {0};
uint8_t spellcheck_buffer_size = 0;
@ -137,7 +138,19 @@ bool process_spellcheck(uint16_t keycode, keyrecord_t* record) {
return true;
}
uint8_t keycode_type = keycode_type_en(mods, keycode);
uint8_t keycode_type;
switch (layer_layouts[biton32(layer_state)]) {
case LAYOUT_EN:
keycode_type = keycode_type_en(mods, keycode);
break;
case LAYOUT_RU:
keycode_type = keycode_type_ru(mods, keycode);
break;
default:
keycode_type = SPELLCHECK_NEITHER;
break;
}
switch(keycode_type) {
// No modifications are needed if this is a regular word character
@ -148,6 +161,7 @@ bool process_spellcheck(uint16_t keycode, keyrecord_t* record) {
memmove(spellcheck_buffer, spellcheck_buffer + 1, SPELLCHECK_BUFFER_MAX - 1);
spellcheck_buffer_size = SPELLCHECK_BUFFER_MAX - 1;
}
spellcheck_buffer[spellcheck_buffer_size++] = (uint8_t) keycode;
return true;
@ -165,8 +179,6 @@ bool process_spellcheck(uint16_t keycode, keyrecord_t* record) {
}
return true;
}