diff options
Diffstat (limited to 'Src/Zle')
-rw-r--r-- | Src/Zle/complist.c | 6 | ||||
-rw-r--r-- | Src/Zle/compmatch.c | 4 | ||||
-rw-r--r-- | Src/Zle/compresult.c | 8 | ||||
-rw-r--r-- | Src/Zle/zle.h | 10 | ||||
-rw-r--r-- | Src/Zle/zle_hist.c | 4 | ||||
-rw-r--r-- | Src/Zle/zle_keymap.c | 6 | ||||
-rw-r--r-- | Src/Zle/zle_main.c | 16 | ||||
-rw-r--r-- | Src/Zle/zle_misc.c | 10 | ||||
-rw-r--r-- | Src/Zle/zle_refresh.c | 32 | ||||
-rw-r--r-- | Src/Zle/zle_thingy.c | 8 | ||||
-rw-r--r-- | Src/Zle/zle_tricky.c | 10 | ||||
-rw-r--r-- | Src/Zle/zle_utils.c | 14 | ||||
-rw-r--r-- | Src/Zle/zle_vi.c | 4 |
13 files changed, 64 insertions, 68 deletions
diff --git a/Src/Zle/complist.c b/Src/Zle/complist.c index e0ee806bb..a84a34768 100644 --- a/Src/Zle/complist.c +++ b/Src/Zle/complist.c @@ -559,7 +559,7 @@ clnicezputs(Listcols colors, char *s, int ml) int i = 0, col = 0, ask, oml = ml; char *t; ZLE_CHAR_T cc; -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT /* * ums is the untokenized, unmetafied string (length umlen) * uptr is a pointer into it @@ -1940,7 +1940,7 @@ msearchpop(int *backp) static Cmatch ** msearch(Cmatch **ptr, int ins, int back, int rep, int *wrapp) { -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT /* MB_CUR_MAX may not be constant */ VARARR(char, s, MB_CUR_MAX+1); #else @@ -1953,7 +1953,7 @@ msearch(Cmatch **ptr, int ins, int back, int rep, int *wrapp) msearchpush(ptr, back); if (ins) { -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT if (lastchar_wide_valid) { int len = wctomb(s, lastchar_wide); diff --git a/Src/Zle/compmatch.c b/Src/Zle/compmatch.c index e4c5a438f..4449f3554 100644 --- a/Src/Zle/compmatch.c +++ b/Src/Zle/compmatch.c @@ -1584,7 +1584,7 @@ sub_match(Cmdata md, char *str, int len, int sfx) { int ret = 0, l, ind, add; char *p, *q; -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT int fulllen = len; char *fullstr = str; mbstate_t ps; @@ -1619,7 +1619,7 @@ sub_match(Cmdata md, char *str, int len, int sfx) || (l < md->len && q[-1] == Meta))) l--; } -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT /* * Make sure we don't end in the middle of a multibyte character. * Don't need to do this if the match ended at the start diff --git a/Src/Zle/compresult.c b/Src/Zle/compresult.c index ad8c8ea62..4018c5488 100644 --- a/Src/Zle/compresult.c +++ b/Src/Zle/compresult.c @@ -2146,15 +2146,15 @@ iprintm(Cmgroup g, Cmatch *mp, UNUSED(int mc), UNUSED(int ml), int lastc, int wi printfmt(m->disp, 0, 1, 0); return; } -#ifdef ZLE_UNICODE_SUPPORT - len = mb_niceformat(m->disp, shout, NULL); +#ifdef MULTIBYTE_SUPPORT + len = mb_niceformat(m->disp, shout, NULL, 0); #else nicezputs(m->disp, shout); len = niceztrlen(m->disp); #endif } else { -#ifdef ZLE_UNICODE_SUPPORT - len = mb_niceformat(m->str, shout, NULL); +#ifdef MULTIBYTE_SUPPORT + len = mb_niceformat(m->str, shout, NULL, 0); #else nicezputs(m->str, shout); len = niceztrlen(m->str); diff --git a/Src/Zle/zle.h b/Src/Zle/zle.h index 26a27fe09..9a3828139 100644 --- a/Src/Zle/zle.h +++ b/Src/Zle/zle.h @@ -27,7 +27,7 @@ * */ -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT typedef wchar_t ZLE_CHAR_T; typedef wchar_t *ZLE_STRING_T; typedef wint_t ZLE_INT_T; @@ -67,9 +67,7 @@ typedef wint_t ZLE_INT_T; * Functions that operate on a metafied string. * These versions handle multibyte characters. */ -#define ZMB_nicewidth(s) mb_niceformat(s, NULL, NULL) -#define ZMB_niceputs(s, stream) (void)mb_niceformat(s, stream, NULL) -#define ZMB_niceztrdup(s) mb_niceztrdup(s) +#define ZMB_nicewidth(s) mb_niceformat(s, NULL, NULL, 0) /* Functions that operate on ZLE_CHAR_T. */ #define ZC_iblank iswspace @@ -84,7 +82,7 @@ typedef wint_t ZLE_INT_T; #define LASTFULLCHAR lastchar_wide -#else /* Not ZLE_UNICODE_SUPPORT: old single-byte code */ +#else /* Not MULTIBYTE_SUPPORT: old single-byte code */ typedef int ZLE_CHAR_T; typedef unsigned char *ZLE_STRING_T; @@ -111,8 +109,6 @@ typedef int ZLE_INT_T; * These versions don't handle multibyte characters. */ #define ZMB_nicewidth niceztrlen -#define ZMB_niceputs nicezputs -#define ZMB_niceztrdup(s) nicedup(s, 0) #define ZC_nicechar nicechar diff --git a/Src/Zle/zle_hist.c b/Src/Zle/zle_hist.c index 402887d98..38540a032 100644 --- a/Src/Zle/zle_hist.c +++ b/Src/Zle/zle_hist.c @@ -1108,7 +1108,7 @@ doisearch(char **args, int dir) } else if (cmd == Th(z_magicspace)) { fixmagicspace(); } else if (cmd == Th(z_selfinsert)) { -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT if (!lastchar_wide_valid) getrestchar(lastchar); #else @@ -1305,7 +1305,7 @@ getvisrchstr(void) if(cmd == Th(z_selfinsertunmeta)) { fixunmeta(); } else { -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT if (!lastchar_wide_valid) getrestchar(lastchar); #else diff --git a/Src/Zle/zle_keymap.c b/Src/Zle/zle_keymap.c index 442efec9b..7d481f3a6 100644 --- a/Src/Zle/zle_keymap.c +++ b/Src/Zle/zle_keymap.c @@ -725,7 +725,7 @@ scanlistmaps(HashNode hn, int list) fputs("-- ", stdout); quotedzputs(n->nam, stdout); } else - ZMB_niceputs(n->nam, stdout); + nicezputs(n->nam, stdout); putchar('\n'); } @@ -818,7 +818,7 @@ bin_bindkey_meta(char *name, char *kmname, Keymap km, UNUSED(char **argv), UNUSE zwarnnam(name, "keymap `%s' is protected", kmname, 0); return 1; } -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT zwarnnam(name, "warning: `bindkey -m' disables multibyte support", NULL, 0); #endif @@ -1051,7 +1051,7 @@ bindlistout(struct bindstate *bs) if (bs->flags & BS_LIST) quotedzputs(bs->bind->nam, stdout); else - ZMB_niceputs(bs->bind->nam, stdout); + nicezputs(bs->bind->nam, stdout); } else printbind(bs->str, stdout); putchar('\n'); diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c index 591b2d585..22dd5779b 100644 --- a/Src/Zle/zle_main.c +++ b/Src/Zle/zle_main.c @@ -100,7 +100,7 @@ int mark; /**/ mod_export int lastchar; -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT /**/ mod_export ZLE_INT_T lastchar_wide; /**/ @@ -633,7 +633,7 @@ getbyte(int keytmout, int *timeout) if (timeout) *timeout = 0; -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT /* * Reading a single byte always invalidates the status * of lastchar_wide. We may fix this up in getrestchar @@ -737,7 +737,7 @@ getfullchar(int keytmout) { int inchar = getbyte(keytmout, NULL); -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT return getrestchar(inchar); #else return inchar; @@ -746,7 +746,7 @@ getfullchar(int keytmout) /**/ -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT /* * Get the remainder of a character if we support multibyte * input strings. It may not require any more input, but @@ -1048,7 +1048,7 @@ execzlefunc(Thingy func, char **args) if(func->flags & DISABLED) { /* this thingy is not the name of a widget */ - char *nm = ZMB_niceztrdup(func->nam); + char *nm = nicedup(func->nam, 0); char *msg = tricat("No such widget `", nm, "'"); zsfree(nm); @@ -1104,7 +1104,7 @@ execzlefunc(Thingy func, char **args) if(prog == &dummy_eprog) { /* the shell function doesn't exist */ - char *nm = ZMB_niceztrdup(w->u.fnnam); + char *nm = nicedup(w->u.fnnam, 0); char *msg = tricat("No such shell function `", nm, "'"); zsfree(nm); @@ -1422,7 +1422,7 @@ describekeybriefly(UNUSED(char **args)) if (!func) is = bindztrdup(str); else - is = ZMB_niceztrdup(func->nam); + is = nicedup(func->nam, 0); msg = appstr(msg, is); zsfree(is); showmsg(msg); @@ -1466,7 +1466,7 @@ whereis(UNUSED(char **args)) if (!(ff.func = executenamedcommand("Where is: "))) return 1; ff.found = 0; - ff.msg = ZMB_niceztrdup(ff.func->nam); + ff.msg = nicedup(ff.func->nam, 0); scankeymap(curkeymap, 1, scanfindfunc, &ff); if (!ff.found) ff.msg = appstr(ff.msg, " is not bound to any key"); diff --git a/Src/Zle/zle_misc.c b/Src/Zle/zle_misc.c index 5a97b0a75..75b907f32 100644 --- a/Src/Zle/zle_misc.c +++ b/Src/Zle/zle_misc.c @@ -60,7 +60,7 @@ doinsert(ZLE_STRING_T zstr, int len) mod_export int selfinsert(UNUSED(char **args)) { -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT /* wint_t and wchar_t not neccessarily the same size */ wchar_t tmp; @@ -82,7 +82,7 @@ fixunmeta(void) lastchar &= 0x7f; if (lastchar == '\r') lastchar = '\n'; -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT /* * TODO: can we do this better? * We need a wide character to insert. @@ -529,7 +529,7 @@ digitargument(UNUSED(char **args)) { int sign = (zmult < 0) ? -1 : 1; -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT /* * It's too dangerous to allow metafied input. See * universalargument for comments on (possibly suboptimal) handling @@ -953,7 +953,7 @@ executenamedcommand(char *prmt) if (len == NAMLEN || cmd != Th(z_selfinsert)) feep = 1; else { -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT if (!lastchar_wide_valid) getrestchar(lastchar); if (iswcntrl(lastchar_wide)) @@ -1137,7 +1137,7 @@ iremovesuffix(ZLE_CHAR_T c, int keep) zsfree(suffixfunc); suffixfunc = NULL; } else { -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT /* TODO: best I can think of for now... */ int sl = (unsigned int)c <= 256 ? suffixlen[c] : 0; #else diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c index 18e120c89..b3ca43fdb 100644 --- a/Src/Zle/zle_refresh.c +++ b/Src/Zle/zle_refresh.c @@ -29,7 +29,7 @@ #include "zle.mdh" -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT /* * We use a wint_t here, since we need an invalid character as a * placeholder and wint_t guarantees that we can use WEOF to do this. @@ -178,7 +178,7 @@ int cost; void zwcputc(ZLE_INT_T c) { -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT char mbtmp[MB_CUR_MAX + 1]; mbstate_t mbstate; int i; @@ -197,7 +197,7 @@ zwcputc(ZLE_INT_T c) static int zwcwrite(REFRESH_STRING s, size_t i) { -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT size_t j; for (j = 0; j < i; j++) @@ -625,7 +625,7 @@ zrefresh(void) *rpms.s++ = ZWC(' '); while ((++t0) & 7); } -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT else if (iswprint(*t)) { int width = wcwidth(*t); if (width > rpms.sen - rpms.s) { @@ -663,7 +663,7 @@ zrefresh(void) if (nextline(&rpms, 1)) break; } -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT *rpms.s++ = ((*t == 127) || (*t > 255)) ? ZWC('?') : (*t | ZWC('@')); #else @@ -698,7 +698,7 @@ zrefresh(void) snextline(&rpms); u = statusline; for (; u < statusline + statusll; u++) { -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT if (iswprint(*u)) { int width = wcwidth(*u); /* Handle wide characters as above */ @@ -1071,12 +1071,12 @@ refreshline(int ln) for (;;) { if (*nl && *ol && nl[1] == ol[1]) { /* skip only if second chars match */ -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT int ccs_was = ccs; #endif /* skip past all matching characters */ for (; *nl && (*nl == *ol); nl++, ol++, ccs++) ; -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT /* Make sure ol and nl are pointing to real characters */ while ((*nl == WEOF || *ol == WEOF) && ccs > ccs_was) { nl--; @@ -1152,7 +1152,7 @@ refreshline(int ln) tc_delchars(i); ol += i; char_ins -= i; -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT while (*ol == WEOF) { ol++; char_ins--; @@ -1191,13 +1191,13 @@ refreshline(int ln) } /* we can't do any fancy tricks, so just dump the single character and keep on trying */ -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT do { #endif zputc(*nl); nl++, ol++; ccs++, vcs++; -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT /* * Make sure we always overwrite the complete width of * a character that was there before. @@ -1336,7 +1336,7 @@ tc_rightcurs(int ct) think. */ if (vln == 0 && i < lpromptw && !(termflags & TERM_SHORT)) { -#ifndef ZLE_UNICODE_SUPPORT +#ifndef MULTIBYTE_SUPPORT if ((int)strlen(lpromptbuf) == lpromptw) fputs(lpromptbuf + i, shout); else @@ -1432,7 +1432,7 @@ singlerefresh(ZLE_STRING_T tmpline, int tmpll, int tmpcs) int t0, /* tmp */ vsiz, /* size of new video buffer */ nvcs = 0; /* new video cursor column */ -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT /* * converted lprompt and pointer: no WEOF hack here since * we always output the full prompt and count its width. @@ -1448,7 +1448,7 @@ singlerefresh(ZLE_STRING_T tmpline, int tmpll, int tmpcs) for (vsiz = 1 + lpromptw, t0 = 0; t0 != tmpll; t0++, vsiz++) if (tmpline[t0] == ZWC('\t')) vsiz = (vsiz | 7) + 1; -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT else if (iswprint(tmpline[t0])) vsiz += wcwidth(tmpline[t0]); #endif @@ -1465,7 +1465,7 @@ singlerefresh(ZLE_STRING_T tmpline, int tmpll, int tmpcs) } /* only use last part of prompt */ -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT /* * Convert the entire lprompt so that we know how to count * characters. @@ -1514,7 +1514,7 @@ singlerefresh(ZLE_STRING_T tmpline, int tmpll, int tmpcs) } else if (tmpline[t0] == ZWC('\n')) { *vp++ = ZWC('\\'); *vp++ = ZWC('n'); -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT } else if (iswprint(tmpline[t0])) { int width; *vp++ = tmpline[t0]; diff --git a/Src/Zle/zle_thingy.c b/Src/Zle/zle_thingy.c index da273132e..5e0c30633 100644 --- a/Src/Zle/zle_thingy.c +++ b/Src/Zle/zle_thingy.c @@ -519,15 +519,15 @@ scanlistwidgets(HashNode hn, int list) quotedzputs(w->u.fnnam, stdout); } } else { - ZMB_niceputs(t->nam, stdout); + nicezputs(t->nam, stdout); if (w->flags & WIDGET_NCOMP) { fputs(" -C ", stdout); - ZMB_niceputs(w->u.comp.wid, stdout); + nicezputs(w->u.comp.wid, stdout); fputc(' ', stdout); - ZMB_niceputs(w->u.comp.func, stdout); + nicezputs(w->u.comp.func, stdout); } else if(strcmp(t->nam, w->u.fnnam)) { fputs(" (", stdout); - ZMB_niceputs(w->u.fnnam, stdout); + nicezputs(w->u.fnnam, stdout); fputc(')', stdout); } } diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c index 0b70c935a..7771ff353 100644 --- a/Src/Zle/zle_tricky.c +++ b/Src/Zle/zle_tricky.c @@ -2244,7 +2244,7 @@ listlist(LinkList l) if (isset(LISTROWSFIRST)) { for (col = 1, p = data, lenp = lens; *p; p++, lenp++, col++) { - ZMB_niceputs(*p, shout); + nicezputs(*p, shout); if (col == ncols) { col = 0; if (p[1]) @@ -2262,7 +2262,7 @@ listlist(LinkList l) for (f = data, fl = lens, line = 0; line < nlines; f++, fl++, line++) { for (col = 1, p = f, lenp = fl; *p; col++) { - ZMB_niceputs(*p, shout); + nicezputs(*p, shout); if (col == ncols) break; if ((i = (pack ? widths[col - 1] : longest) - *lenp + 2) > 0) @@ -2276,7 +2276,7 @@ listlist(LinkList l) } } else { for (p = data; *p; p++) { - ZMB_niceputs(*p, shout); + nicezputs(*p, shout); putc('\n', shout); } } @@ -2367,7 +2367,7 @@ void fixmagicspace(void) { lastchar = ' '; -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT /* * This is redundant if the multibyte encoding extends ASCII, * since lastchar is a full character, but it's safer anyway... @@ -2386,7 +2386,7 @@ magicspace(char **args) int ret; fixmagicspace(); -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT /* * TODO: bangchar should really be a multibyte string representing * a single character, since there's no fundamental reason why diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c index a65aa05d0..063427659 100644 --- a/Src/Zle/zle_utils.c +++ b/Src/Zle/zle_utils.c @@ -132,7 +132,7 @@ zlelineasstring(ZLE_STRING_T instr, int inll, int incs, int *outllp, { int outcs, outll; -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT char *s; int i, j; size_t mb_len = 0; @@ -167,7 +167,7 @@ zlelineasstring(ZLE_STRING_T instr, int inll, int incs, int *outllp, * metafiable characters. */ if (outcsp != NULL || outllp != NULL) { -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT unsigned char *strp = (unsigned char *)s; #else unsigned char *strp = instr; @@ -189,7 +189,7 @@ zlelineasstring(ZLE_STRING_T instr, int inll, int incs, int *outllp, *outllp = outll; } -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT if (useheap) { unsigned char *ret = @@ -242,7 +242,7 @@ stringaszleline(unsigned char *instr, int incs, { ZLE_STRING_T outstr; int ll, sz; -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT mbstate_t ps; #endif @@ -274,7 +274,7 @@ stringaszleline(unsigned char *instr, int incs, *outsz = ll; outstr = (ZLE_STRING_T)zalloc(sz); -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT if (ll) { char *inptr = (char *)instr; wchar_t *outptr = outstr; @@ -785,7 +785,7 @@ showmsg(char const *msg) char const *p; int up = 0, cc = 0; ZLE_CHAR_T c; -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT char *umsg; int ulen, ret; size_t width; @@ -795,7 +795,7 @@ showmsg(char const *msg) trashzle(); clearflag = isset(USEZLE) && !termflags && isset(ALWAYSLASTPROMPT); -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT umsg = ztrdup(msg); p = unmetafy(umsg, &ulen); memset(&ps, 0, sizeof(ps)); diff --git a/Src/Zle/zle_vi.c b/Src/Zle/zle_vi.c index cb072cdb6..5be0eeef3 100644 --- a/Src/Zle/zle_vi.c +++ b/Src/Zle/zle_vi.c @@ -135,7 +135,7 @@ vigetkey(void) } else if (cmd == Th(z_vicmdmode)) { return ZLEEOF; } -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT if (!lastchar_wide_valid) { getrestchar(lastchar); @@ -830,7 +830,7 @@ vicapslockpanic(UNUSED(char **args)) statusline = ZWS("press a lowercase key to continue"); statusll = ZS_strlen(statusline); zrefresh(); -#ifdef ZLE_UNICODE_SUPPORT +#ifdef MULTIBYTE_SUPPORT while (!iswlower(getfullchar(0))); #else while (!islower(getfullchar(0))); |