Skip to content
Myr

main: keyboard repeat: handle multi-byte characeters

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Daniel Eklöf · committed by Daniel Eklöf · parent b91e8ca · Browse files · 1 file+5 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+5 added−3 removed

  • other:+5 added−3 removed

1 file+5 added−3 removed

modified:main.c+5 added-3 removed
89 unmodified lines
90 enum {REPEAT_STOP, REPEAT_START, REPEAT_EXIT} cmd;9192 int32_t delay;93 int32_t rate;94 char character;94 char *characters;95 } repeat;96};9798static const int width = 500;
58 unmodified lines
157 return 0;158 }159160 assert(c->repeat.cmd == REPEAT_START);161 LOG_DBG("repeater: repeat: %c", c->repeat.character);161 LOG_DBG("repeater: repeat: %s", c->repeat.characters);162163 delay = rate_delay;164 mtx_unlock(&c->repeat.mutex);165 }
254 unmodified lines
420 return;421422 mtx_lock(&c->repeat.mutex);423 c->repeat.cmd = REPEAT_START;424 free(c->repeat.characters);424 c->repeat.character = buf[0];425 c->repeat.characters = strdup(buf);426 cnd_signal(&c->repeat.cond);427 mtx_unlock(&c->repeat.mutex);428429 const size_t new_len = strlen(c->prompt.text) + count + 1;
538 unmodified lines
968969 thrd_join(keyboard_repeater_id, NULL);970 cnd_destroy(&c.repeat.cond);971 mtx_destroy(&c.repeat.mutex);972 free(c.repeat.characters);973974 return ret;975}