mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-25 05:27:00 +03:00
Make nsfont_split implementation better for core textarea.
This commit is contained in:
parent
a6e56546c9
commit
bf7b23506d
@ -358,10 +358,23 @@ bool nsfont_split(const plot_font_style_t *fstyle,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (*char_offset != length)
|
||||
if (*char_offset != length) {
|
||||
/* we found something to split at */
|
||||
size_t orig = *char_offset;
|
||||
|
||||
/* ensure a space at <= the split point we found */
|
||||
while (*char_offset && string[*char_offset] != ' ')
|
||||
(*char_offset)--;
|
||||
|
||||
/* nothing valid found <= split point, advance to next space */
|
||||
if (*char_offset == 0) {
|
||||
*char_offset = orig;
|
||||
while (*char_offset != length &&
|
||||
string[*char_offset] != ' ')
|
||||
(*char_offset)++;
|
||||
}
|
||||
}
|
||||
|
||||
code = rufl_width(font_family, font_style, font_size,
|
||||
string, *char_offset,
|
||||
actual_x);
|
||||
|
Loading…
Reference in New Issue
Block a user