diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/tk/text.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/tk/text.c b/src/tk/text.c index 027da71..7406b0b 100644 --- a/src/tk/text.c +++ b/src/tk/text.c @@ -303,7 +303,6 @@ mftk_text_new(char min_char, char max_char, int len, const char *val, t->min_char = min_char; t->max_char = max_char; t->len = len; - t->cur = strlen(val); t->font = font; t->line_skip = TTF_FontLineSkip(font); t->ascent = TTF_FontAscent (font); @@ -330,6 +329,11 @@ mftk_text_new(char min_char, char max_char, int len, const char *val, free(w); return NULL; } + + t->cur = strlen(val); + if (t->cur > t->len) { + t->cur = t->len; + } memcpy(t->val, val, t->cur); w->w = 0; |