Fix for wordwrapping when there is a space then a newline

release/v2.9
inmarket 2018-01-05 15:55:30 +10:00
parent 87ec4b7c77
commit c41cbd05e9
1 changed files with 42 additions and 38 deletions

View File

@ -31,7 +31,7 @@ static bool get_wordlen(const struct mf_font_s *font, mf_str *text,
struct wordlen_s *result)
{
mf_char c;
mf_str prev;
mf_str prev = *text;
result->word = 0;
result->space = 0;
@ -42,10 +42,11 @@ static bool get_wordlen(const struct mf_font_s *font, mf_str *text,
{
result->chars++;
result->word += mf_character_width(font, c);
prev = *text;
c = mf_getchar(text);
}
prev = *text;
while (c && is_wrap_space(c))
{
result->chars++;
@ -56,8 +57,11 @@ static bool get_wordlen(const struct mf_font_s *font, mf_str *text,
result->space += mf_character_width(font, '-');
else if (c == '\t')
result->space += mf_character_width(font, 'm') * MF_TABSIZE;
else if (c == '\n')
else if (c == '\n') {
/* Special case for newlines, skip the character then break. */
prev = *text;
break;
}
prev = *text;
c = mf_getchar(text);