- use iswspace to classify whitespace in V_BreakLines.

isspace does not work because it is limited to 8-bit character sets.
This commit is contained in:
Christoph Oelckers 2018-02-27 11:10:47 +01:00
parent 883a6ffe3a
commit fd27b22857
1 changed files with 5 additions and 4 deletions

View File

@ -35,6 +35,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>
#include <ctype.h> #include <ctype.h>
#include <wctype.h>
#include "v_text.h" #include "v_text.h"
@ -387,7 +388,7 @@ FBrokenLines *V_BreakLines (FFont *font, int maxwidth, const uint8_t *string, bo
continue; continue;
} }
if (isspace(c)) if (iswspace(c))
{ {
if (!lastWasSpace) if (!lastWasSpace)
{ {
@ -420,12 +421,12 @@ FBrokenLines *V_BreakLines (FFont *font, int maxwidth, const uint8_t *string, bo
start = space; start = space;
space = NULL; space = NULL;
while (*start && isspace (*start) && *start != '\n') while (*start && iswspace (*start) && *start != '\n')
start++; start++;
if (*start == '\n') if (*start == '\n')
start++; start++;
else else
while (*start && isspace (*start)) while (*start && iswspace (*start))
start++; start++;
string = start; string = start;
} }
@ -443,7 +444,7 @@ FBrokenLines *V_BreakLines (FFont *font, int maxwidth, const uint8_t *string, bo
while (s < string) while (s < string)
{ {
// If there is any non-white space in the remainder of the string, add it. // If there is any non-white space in the remainder of the string, add it.
if (!isspace (*s++)) if (!iswspace (*s++))
{ {
auto i = Lines.Reserve(1); auto i = Lines.Reserve(1);
breakit (&Lines[i], font, start, string, linecolor); breakit (&Lines[i], font, start, string, linecolor);