aboutsummaryrefslogtreecommitdiff
path: root/toys/pending
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2021-05-15 11:14:03 -0500
committerRob Landley <rob@landley.net>2021-05-15 11:14:03 -0500
commitd3025b14b9c13286b79f256d019a99da9425ea0e (patch)
tree02a40c59346677cb5f6a51137f4a39d16ae6b743 /toys/pending
parent08481ee37ad5070ff1033d57351c3fa456d0729d (diff)
downloadtoybox-d3025b14b9c13286b79f256d019a99da9425ea0e.tar.gz
Convert utf8towc from wchar_t to unsigned (to match wctoutf8).
The maximum unicode code point is 0x10ffff which is 21 bits.
Diffstat (limited to 'toys/pending')
-rw-r--r--toys/pending/vi.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/toys/pending/vi.c b/toys/pending/vi.c
index da43d5d5..87c49d13 100644
--- a/toys/pending/vi.c
+++ b/toys/pending/vi.c
@@ -84,7 +84,7 @@ static const char *specials = ",.:;=-+*/(){}<>[]!@#$%^&|\\?\"\'";
//get utf8 length and width at same time
static int utf8_lnw(int *width, char *s, int bytes)
{
- wchar_t wc;
+ unsigned wc;
int length = 1;
if (*s == '\t') *width = TT.tabstop;
@@ -1312,10 +1312,9 @@ static int crunch_nstr(char **str, int width, int n, FILE *out, char *escmore,
{
int columns = 0, col, bytes;
char *start, *end;
+ unsigned wc;
for (end = start = *str; *end && n>0; columns += col, end += bytes, n -= bytes) {
- wchar_t wc;
-
if ((bytes = utf8towc(&wc, end, 4))>0 && (col = wcwidth(wc))>=0) {
if (!escmore || wc>255 || !strchr(escmore, wc)) {
if (width-columns<col) break;