You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ncstrwidth() returns the column width of a utf8 string, but returns -1 if any element is invalid. depending on a given libc's unicode conformance, valid utf8 might not be recognized. ncplane_put*() will output up to the first invalid input. we ought then have an analogue, call it ehhhhh ncstrwidth_valid() (better name?):
int ncstrwidth_valid(const char* egcs, int* validbytes, *validwidth);
which will write into a non-NULLvalidbytes the length in bytes of the valid prefix, and write into a non-NULLvalidwidth the length in columns of the valid prefix. if the return value is non-negative, all input was processed (and the return value will be equal to *validwidth). if it is negative, there was an invalid character.
we could just return one or the other as the negative magnitude, but that's kinda sleazy imho (though i think we do it for ncplane_put*() actually, so maybe we ought do so here as well, for conformity?).
ncstrwidth() ought then be implemented as a static inline wrapper around this function, though that won't fly until ABI3; we'll need keep it a symbol for now.
The text was updated successfully, but these errors were encountered:
ncstrwidth()
returns the column width of a utf8 string, but returns -1 if any element is invalid. depending on a given libc's unicode conformance, valid utf8 might not be recognized.ncplane_put*()
will output up to the first invalid input. we ought then have an analogue, call it ehhhhhncstrwidth_valid()
(better name?):int ncstrwidth_valid(const char* egcs, int* validbytes, *validwidth);
which will write into a non-
NULL
validbytes
the length in bytes of the valid prefix, and write into a non-NULL
validwidth
the length in columns of the valid prefix. if the return value is non-negative, all input was processed (and the return value will be equal to*validwidth
). if it is negative, there was an invalid character.we could just return one or the other as the negative magnitude, but that's kinda sleazy imho (though i think we do it for
ncplane_put*()
actually, so maybe we ought do so here as well, for conformity?).ncstrwidth()
ought then be implemented as astatic inline
wrapper around this function, though that won't fly until ABI3; we'll need keep it a symbol for now.The text was updated successfully, but these errors were encountered: