Add offset to cycle to allow stepping in reverse

This commit is contained in:
Konstantin Đorđević 2018-11-05 20:33:56 +01:00
parent bd68cfe688
commit 1a19eb78f1
3 changed files with 4 additions and 4 deletions

View file

@ -38,7 +38,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return false; return false;
case CYCLEUC: case CYCLEUC:
if (record->event.pressed) { cycle_unicode_input_mode(); } if (record->event.pressed) { cycle_unicode_input_mode(+1); }
return false; return false;
case NUMPAD: case NUMPAD:

View file

@ -56,9 +56,9 @@ void unicode_input_mode_init(void) {
dprintf("input_mode init to: %u\n", unicode_config.input_mode); dprintf("input_mode init to: %u\n", unicode_config.input_mode);
} }
void cycle_unicode_input_mode(void) { void cycle_unicode_input_mode(uint8_t offset) {
#if UNICODE_SELECTED_MODES != -1 #if UNICODE_SELECTED_MODES != -1
selected_index = (selected_index + 1) % selected_count; selected_index = (selected_index + offset) % selected_count;
unicode_config.input_mode = selected[selected_index]; unicode_config.input_mode = selected[selected_index];
#if UNICODE_CYCLE_PERSIST #if UNICODE_CYCLE_PERSIST
persist_unicode_input_mode(); persist_unicode_input_mode();

View file

@ -49,7 +49,7 @@ extern unicode_config_t unicode_config;
void set_unicode_input_mode(uint8_t os_target); void set_unicode_input_mode(uint8_t os_target);
uint8_t get_unicode_input_mode(void); uint8_t get_unicode_input_mode(void);
void unicode_input_mode_init(void); void unicode_input_mode_init(void);
void cycle_unicode_input_mode(void); void cycle_unicode_input_mode(uint8_t offset);
void persist_unicode_input_mode(void); void persist_unicode_input_mode(void);
void unicode_input_start(void); void unicode_input_start(void);