From 189b9e23edfe60b7e82c4c7b6071a3f98799653a Mon Sep 17 00:00:00 2001 From: Nicholas Noll Date: Tue, 26 Oct 2021 21:32:55 -0700 Subject: fix(unicode): renamed functions to be easier to understand their functions --- sys/cmd/dwm/drw.c | 2 +- sys/cmd/term/term.c | 10 +++++----- sys/cmd/term/x.c | 2 +- sys/cmd/wm/main.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'sys/cmd') diff --git a/sys/cmd/dwm/drw.c b/sys/cmd/dwm/drw.c index 825e2f4..a6d6902 100644 --- a/sys/cmd/dwm/drw.c +++ b/sys/cmd/dwm/drw.c @@ -227,7 +227,7 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp utf8str = text; nextfont = NULL; while (*text) { - utf8charlen = utf8·bytetorune(&utf8codepoint, text); + utf8charlen = utf8·decode(text, &utf8codepoint); for (curfont = drw->fonts; curfont; curfont = curfont->next) { charexists = charexists || XftCharExists(drw->dpy, curfont->xfont, utf8codepoint); if (charexists) { diff --git a/sys/cmd/term/term.c b/sys/cmd/term/term.c index 6a73a8b..b08915e 100644 --- a/sys/cmd/term/term.c +++ b/sys/cmd/term/term.c @@ -410,7 +410,7 @@ getsel(void) if (gp->mode & Gwdummy) continue; - ptr += utf8·runetobyte(ptr, &gp->u); + ptr += utf8·encode(&gp->u, ptr); } /* @@ -993,7 +993,7 @@ tsetchar(rune u, Letter *attr, int x, int y) */ if (term.trantbl[term.charset] == CSgfx0 && BETWEEN(u, 0x41, 0x7e) && vt100_0[u - 0x41]) - utf8·bytetorune(&u, vt100_0[u - 0x41]); + utf8·decode(vt100_0[u - 0x41], &u); if (term.line[y][x].mode & Gwide) { if (x+1 < term.col) { @@ -1801,7 +1801,7 @@ tdumpline(int n) end = &bp[MIN(tlinelen(n), term.col) - 1]; if (bp != end || bp->u != ' ') { for ( ; bp <= end; ++bp) - tprinter(buf, utf8·runetobyte(buf, &bp->u)); + tprinter(buf, utf8·encode(&bp->u, buf)); } tprinter("\n", 1); } @@ -2090,7 +2090,7 @@ tputc(rune u) c[0] = u; width = len = 1; } else { - len = utf8·runetobyte(c, &u); + len = utf8·encode(&u, c); if(!control && (width = wcwidth(u)) == -1) width = 1; } @@ -2257,7 +2257,7 @@ twrite(char *buf, int buflen, int show_ctrl) for (n = 0; n < buflen; n += charsize) { if(IS_SET(Tutf8) && !IS_SET(Tsixel)) { /* process a complete utf8 char */ - charsize = utf8·bytetorune(&u, buf + n); + charsize = utf8·decode(buf + n, &u); if(charsize == 0) break; } else { diff --git a/sys/cmd/term/x.c b/sys/cmd/term/x.c index 3079f38..ea64bff 100644 --- a/sys/cmd/term/x.c +++ b/sys/cmd/term/x.c @@ -1824,7 +1824,7 @@ kpress(XEvent *ev) if (IS_SET(W8bit)) { if (*buf < 0177) { c = *buf | 0x80; - len = utf8·runetobyte(buf, &c); + len = utf8·encode(&c, buf); } } else { buf[1] = buf[0]; diff --git a/sys/cmd/wm/main.c b/sys/cmd/wm/main.c index a447d80..2607801 100644 --- a/sys/cmd/wm/main.c +++ b/sys/cmd/wm/main.c @@ -133,7 +133,7 @@ main(int argc, char *argv[]) { char *socket, *cmd=nil; - ARGBEGIN { + ARGBEGIN{ case 's': cmd = ARGF(); break; -- cgit v1.2.1