mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-22 21:32:31 +00:00
Fix printvideo regression and minor improvements
This commit is contained in:
parent
eb4bb43275
commit
e86cff8ba0
25 changed files with 240 additions and 207 deletions
|
@ -7,9 +7,9 @@ COSMOPOLITAN_C_START_
|
|||
│ cosmopolitan § characters » unicode ─╬─│┼
|
||||
╚────────────────────────────────────────────────────────────────────────────│*/
|
||||
|
||||
extern const uint64_t kEastAsianWidth[];
|
||||
extern const uint8_t kEastAsianWidth[];
|
||||
extern const uint32_t kEastAsianWidthBits;
|
||||
extern const uint64_t kCombiningChars[];
|
||||
extern const uint8_t kCombiningChars[];
|
||||
extern const uint32_t kCombiningCharsBits;
|
||||
|
||||
/*───────────────────────────────────────────────────────────────────────────│─╗
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
│ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA │
|
||||
│ 02110-1301 USA │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/bits/bits.h"
|
||||
#include "libc/unicode/unicode.h"
|
||||
|
||||
/**
|
||||
|
@ -28,10 +27,10 @@ int wcwidth(wchar_t ucs) {
|
|||
if (ucs < 32 || (ucs >= 0x7f && ucs < 0xa0)) {
|
||||
return -1;
|
||||
} else if (0 <= ucs && ucs < kCombiningCharsBits &&
|
||||
bt(kCombiningChars, ucs)) {
|
||||
!!(kCombiningChars[ucs >> 3] & (1 << (ucs & 7)))) {
|
||||
return 0;
|
||||
} else if (0 <= ucs && ucs < kEastAsianWidthBits) {
|
||||
return 1 + bt(kEastAsianWidth, ucs);
|
||||
return 1 + !!(kEastAsianWidth[ucs >> 3] & (1 << (ucs & 7)));
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue