Improved spellcheck sending

master
Mark 2022-07-21 21:20:16 -07:00
parent c757a1686c
commit bf6faeb94f
Signed by: Mark
GPG Key ID: AD62BB059C2AAEE4
5 changed files with 28 additions and 14 deletions

View File

@ -4,3 +4,13 @@
extern const int8_t fft_array_to_col[4][14]; extern const int8_t fft_array_to_col[4][14];
extern const int8_t fft_col_to_array[10][5]; extern const int8_t fft_col_to_array[10][5];
extern uint8_t layer_layouts[];
// Language keymap ids for layers.
// See layers/definitions/symbols.h.
enum layer_layout_ids {
LAYOUT_NULL, // This layer doesn't care what keymap the OS is using
LAYOUT_EN, // This layer is designed for the standard keymapping
LAYOUT_RU,
};

View File

@ -5,6 +5,7 @@
#include "features/spellcheck.h" #include "features/spellcheck.h"
#include "features/beta_rawhid.h" #include "features/beta_rawhid.h"
#include "extra_mappings.h"
uint8_t spellcheck_buffer[SPELLCHECK_BUFFER_MAX] = {0}; uint8_t spellcheck_buffer[SPELLCHECK_BUFFER_MAX] = {0};
uint8_t spellcheck_buffer_size = 0; uint8_t spellcheck_buffer_size = 0;
@ -137,7 +138,19 @@ bool process_spellcheck(uint16_t keycode, keyrecord_t* record) {
return true; 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) { switch(keycode_type) {
// No modifications are needed if this is a regular word character // 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); memmove(spellcheck_buffer, spellcheck_buffer + 1, SPELLCHECK_BUFFER_MAX - 1);
spellcheck_buffer_size = SPELLCHECK_BUFFER_MAX - 1; spellcheck_buffer_size = SPELLCHECK_BUFFER_MAX - 1;
} }
spellcheck_buffer[spellcheck_buffer_size++] = (uint8_t) keycode; spellcheck_buffer[spellcheck_buffer_size++] = (uint8_t) keycode;
return true; return true;
@ -165,8 +179,6 @@ bool process_spellcheck(uint16_t keycode, keyrecord_t* record) {
} }
return true; return true;
} }

View File

@ -22,14 +22,6 @@ extern rgb_config_t rgb_matrix_config;
#define LC_RU_G LC_HSV(153, 255, 153) #define LC_RU_G LC_HSV(153, 255, 153)
#define LC_RU_K LC_HSV( 0, 255, 145) #define LC_RU_K LC_HSV( 0, 255, 145)
// Language keymap ids for layers.
// See layers/definitions/symbols.h.
enum layer_layout_ids {
LAYOUT_NULL, // This layer doesn't care what keymap the OS is using
LAYOUT_EN, // This layer is designed for the standard keymapping
LAYOUT_RU,
};
// Define custom keys // Define custom keys
// (Must be done before keymaps are loaded) // (Must be done before keymaps are loaded)
enum custom_keycodes { enum custom_keycodes {

View File

@ -14,7 +14,7 @@
// What OS keyboard layout this layer is designed for. // What OS keyboard layout this layer is designed for.
// See keymap.h for possible values. // See extra_mappings.h for possible values.
// //
// Every layer must have this section. // Every layer must have this section.
#ifdef BETA_LAYER_LAYOUTS #ifdef BETA_LAYER_LAYOUTS

View File

@ -1,5 +1,5 @@
#include "layers.h" #include "layers.h"
#include "extra_mappings.h"
// Create keymap array // Create keymap array
#define BETA_LAYER_KEYS #define BETA_LAYER_KEYS