mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-11 10:41:30 +00:00
LibC: Partially implement wcwidth
This commit is contained in:
parent
a66c358c52
commit
9c29e6cde7
Notes:
sideshowbarker
2024-07-18 02:19:18 +09:00
Author: https://github.com/timschumi
Commit: 9c29e6cde7
Pull-request: https://github.com/SerenityOS/serenity/pull/10427
Reviewed-by: https://github.com/BertalanD
Reviewed-by: https://github.com/bgianfo
2 changed files with 18 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue