diff options
Diffstat (limited to 'src/tk')
-rw-r--r-- | src/tk/text.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/tk/text.c b/src/tk/text.c index 6a89b44..4a8196d 100644 --- a/src/tk/text.c +++ b/src/tk/text.c @@ -136,6 +136,7 @@ _mftk_text_key_event(struct mftk_widget *w, SDL_Event *e) if (len + newlen > t->len) { newlen = t->len - len; } + memcpy(t->curval, t->val + t->cur, len - t->cur); for (i = 0, j = 0; i < newlen && e->text.text[j] != '\0'; ++j) { @@ -145,6 +146,8 @@ _mftk_text_key_event(struct mftk_widget *w, SDL_Event *e) ++i; } t->cur += i; + memcpy(t->val + t->cur, t->curval, len - t->cur + i); + t->val[len + i] = '\0'; SDL_DestroyTexture(t->texture); t->texture = NULL; if (t->action == NULL) { |