mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-03-22 21:37:22 +00:00
LibC: Partially implement wcwidth
This commit is contained in:
committed by
Brian Gianforcaro
parent
a66c358c52
commit
9c29e6cde7
@@ -432,4 +432,21 @@ int swprintf(wchar_t*, size_t, const wchar_t*, ...)
|
||||
dbgln("TODO: Implement swprintf()");
|
||||
TODO();
|
||||
}
|
||||
|
||||
int wcwidth(wchar_t wc)
|
||||
{
|
||||
if (wc == L'\0')
|
||||
return 0;
|
||||
|
||||
// Printable ASCII.
|
||||
if (wc >= 0x20 && wc <= 0x7e)
|
||||
return 1;
|
||||
|
||||
// Non-printable ASCII.
|
||||
if (wc <= 0x7f)
|
||||
return -1;
|
||||
|
||||
// TODO: Implement wcwidth for non-ASCII characters.
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,5 +55,6 @@ float wcstof(const wchar_t*, wchar_t**);
|
||||
double wcstod(const wchar_t*, wchar_t**);
|
||||
long double wcstold(const wchar_t*, wchar_t**);
|
||||
int swprintf(wchar_t*, size_t, const wchar_t*, ...);
|
||||
int wcwidth(wchar_t);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
Reference in New Issue
Block a user