diff --git a/src/lib/egcpool.h b/src/lib/egcpool.h index 67d7711a5..3706722cb 100644 --- a/src/lib/egcpool.h +++ b/src/lib/egcpool.h @@ -11,7 +11,6 @@ #include #include #include -#include "ncwidth.h" #include "notcurses/notcurses.h" #ifdef __cplusplus @@ -67,7 +66,7 @@ egcpool_grow(egcpool* pool, size_t len){ // any NUL terminator. Neither the number of bytes nor columns is necessarily // equal to the number of decoded code points. Such are the ways of Unicode. // uc_is_grapheme_break() wants UTF-32, which is fine, because we need wchar_t -// to use ncwidth() anyway FIXME except this doesn't work with 16-bit wchar_t! +// to use wcwidth() anyway FIXME except this doesn't work with 16-bit wchar_t! static inline int utf8_egc_len(const char* gcluster, int* colcount){ size_t ret = 0; @@ -84,7 +83,7 @@ utf8_egc_len(const char* gcluster, int* colcount){ if(prevw && uc_is_grapheme_break(prevw, wc)){ break; // starts a new EGC, exit and do not claim } - int cols = ncwidth(wc); + int cols = wcwidth(wc); if(cols < 0){ if(iswspace(wc)){ // newline or tab return ret + 1; diff --git a/src/lib/internal.h b/src/lib/internal.h index 1eebb58ce..6dbf460c9 100644 --- a/src/lib/internal.h +++ b/src/lib/internal.h @@ -397,7 +397,7 @@ mbstr_find_codepoint(const char* s, char32_t cp, int* col){ if(towlower(cp) == towlower(w)){ return bytes; } - *col += ncwidth(w); + *col += wcwidth(w); bytes += r; } return -1; diff --git a/src/lib/layout.c b/src/lib/layout.c index f35be4b33..dccd2e53d 100644 --- a/src/lib/layout.c +++ b/src/lib/layout.c @@ -95,7 +95,7 @@ puttext_line(ncplane* n, ncalign_e align, const char* text, size_t* bytes){ return cols; } b += consumed; - int width = ncwidth(w); + int width = wcwidth(w); if(width < 0){ width = 0; // FIXME } diff --git a/src/lib/ncwidth.h b/src/lib/ncwidth.h deleted file mode 100644 index 42725f8a5..000000000 --- a/src/lib/ncwidth.h +++ /dev/null @@ -1,18 +0,0 @@ -#include - -// wcwidth() might be missing some lengths (for instance, glibc didn't get -// Unicode 13 support until 2.31). ncwidth() handles some characters on the -// wcwidth() error path. it ought generally be used rather than wcwidth(). -static inline int -ncwidth(wchar_t c){ - int r = wcwidth(c); - if(r >= 0){ - return r; - } - // Symbols for Legacy Computing were only added to glibc in 2.32 (along with - // the rest of Unicode 13). Handle them explicitly if wcwidth() failed. - if(c >= 0x1fb00 && c <= 0x1fb3b){ - return 1; - } - return -1; -}