Fixed text wrapping without seperator
This commit is contained in:
parent
ebe516c37b
commit
ca1c9b3275
@ -1,4 +1,5 @@
|
||||
# Changelog
|
||||
- 2016/12/03 (1.191)- Fixed wrapped text with no seperator and C89 error
|
||||
- 2016/12/03 (1.19) - Changed text wrapping to process words not characters
|
||||
- 2016/11/22 (1.184)- Fixed window minimized closing bug
|
||||
- 2016/11/19 (1.184)- Fixed abstract combo box closing behavior
|
||||
|
@ -5056,7 +5056,7 @@ nk_text_clamp(const struct nk_user_font *font, const char *text,
|
||||
} else {
|
||||
*glyphs = sep_g;
|
||||
*text_width = sep_width;
|
||||
return sep_len;
|
||||
return (!sep_len) ? len: sep_len;
|
||||
}
|
||||
}
|
||||
|
||||
@ -12637,6 +12637,7 @@ nk_widget_text_wrap(struct nk_command_buffer *o, struct nk_rect b,
|
||||
int done = 0;
|
||||
struct nk_rect line;
|
||||
struct nk_text text;
|
||||
NK_INTERN nk_rune seperator[] = {' '};
|
||||
|
||||
NK_ASSERT(o);
|
||||
NK_ASSERT(t);
|
||||
@ -12655,14 +12656,13 @@ nk_widget_text_wrap(struct nk_command_buffer *o, struct nk_rect b,
|
||||
line.w = b.w - 2 * t->padding.x;
|
||||
line.h = 2 * t->padding.y + f->height;
|
||||
|
||||
nk_rune seperator[] = {' '};
|
||||
fitting = nk_text_clamp(f, string, len, line.w, &glyphs, &width, seperator,1);
|
||||
fitting = nk_text_clamp(f, string, len, line.w, &glyphs, &width, seperator,NK_LEN(seperator));
|
||||
while (done < len) {
|
||||
if (!fitting || line.y + line.h >= (b.y + b.h)) break;
|
||||
nk_widget_text(o, line, &string[done], fitting, &text, NK_TEXT_LEFT, f);
|
||||
done += fitting;
|
||||
line.y += f->height + 2 * t->padding.y;
|
||||
fitting = nk_text_clamp(f, &string[done], len - done, line.w, &glyphs, &width, seperator,1);
|
||||
fitting = nk_text_clamp(f, &string[done], len - done, line.w, &glyphs, &width, seperator,NK_LEN(seperator));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user