diff options
author | Axel Beckert <abe@deuxchevaux.org> | 2022-04-11 00:17:48 +0200 |
---|---|---|
committer | Axel Beckert <abe@deuxchevaux.org> | 2022-04-11 00:17:48 +0200 |
commit | b09f4483416c54c1782824633dfabaf2ec0265b6 (patch) | |
tree | 304bc82642862525ae680c7fbaa249663b10ad57 /Src/Zle/complist.c | |
parent | 12eb3e5356f2fc3351eed58ef1cef1b8fb83b504 (diff) | |
parent | 6e55c920503071e917619b8cb1a188cd35d772db (diff) | |
download | zsh-b09f4483416c54c1782824633dfabaf2ec0265b6.tar.gz zsh-b09f4483416c54c1782824633dfabaf2ec0265b6.zip |
New upstream version 5.8.1.2-test
Diffstat (limited to 'Src/Zle/complist.c')
-rw-r--r-- | Src/Zle/complist.c | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/Src/Zle/complist.c b/Src/Zle/complist.c index 429c8159f..0dc64db6a 100644 --- a/Src/Zle/complist.c +++ b/Src/Zle/complist.c @@ -603,6 +603,16 @@ zcoff(void) zcputs(NULL, COL_NO); } +/* Clear to end of line, if possible and necessary. */ +static void +cleareol() +{ + if (mlbeg >= 0 && tccan(TCCLEAREOL)) { + if (*last_cap) + zcoff(); /* If we used colors, prevent them from bleeding. */ + tcout(TCCLEAREOL); + } +} static void initiscol(void) @@ -670,8 +680,7 @@ clprintfmt(char *p, int ml) doiscol(i++); cc++; if (*p == '\n') { - if (mlbeg >= 0 && tccan(TCCLEAREOL)) - tcout(TCCLEAREOL); + cleareol(); cc = 0; } if (ml == mlend - 1 && (cc % zterm_columns) == zterm_columns - 1) @@ -693,8 +702,7 @@ clprintfmt(char *p, int ml) !--mrestlines && (ask = asklistscroll(ml))) return ask; } - if (mlbeg >= 0 && tccan(TCCLEAREOL)) - tcout(TCCLEAREOL); + cleareol(); return 0; } @@ -1047,8 +1055,7 @@ compprintnl(int ml) { int ask; - if (mlbeg >= 0 && tccan(TCCLEAREOL)) - tcout(TCCLEAREOL); + cleareol(); putc('\n', shout); if (mscroll && !--mrestlines && (ask = asklistscroll(ml))) @@ -1263,8 +1270,8 @@ compprintfmt(char *fmt, int n, int dopr, int doesc, int ml, int *stop) if ((cc >= zterm_columns - 2 || cchar == ZWC('\n')) && stat) dopr = 2; if (cchar == ZWC('\n')) { - if (dopr == 1 && mlbeg >= 0 && tccan(TCCLEAREOL)) - tcout(TCCLEAREOL); + if (dopr == 1) + cleareol(); l += 1 + ((cc - 1) / zterm_columns); cc = 0; } @@ -1306,8 +1313,7 @@ compprintfmt(char *fmt, int n, int dopr, int doesc, int ml, int *stop) if (dopr) { if (!(cc % zterm_columns)) fputs(" \010", shout); - if (mlbeg >= 0 && tccan(TCCLEAREOL)) - tcout(TCCLEAREOL); + cleareol(); } if (stat && n) mfirstl = -1; @@ -1338,8 +1344,8 @@ compzputs(char const *s, int ml) c = *s; s++; putc(c, shout); - if (c == '\n' && mlbeg >= 0 && tccan(TCCLEAREOL)) - tcout(TCCLEAREOL); + if (c == '\n') + cleareol(); if (mscroll && (++col == zterm_columns || c == '\n')) { ml++; if (!--mrestlines && (ask = asklistscroll(ml))) @@ -1692,8 +1698,7 @@ compprintlist(int showall) lastlistlen = listdat.nlines; } else if ((nl = listdat.nlines + nlnct - 1) < zterm_lines) { - if (mlbeg >= 0 && tccan(TCCLEAREOL)) - tcout(TCCLEAREOL); + cleareol(); tcmultout(TCUP, TCMULTUP, nl); showinglist = -1; @@ -3277,9 +3282,8 @@ domenuselect(Hookdef dummy, Chdata dat) !strcmp(cmd->nam, "reverse-menu-complete")) { mode = 0; comprecursive = 1; - unmetafy_line(); - reversemenucomplete(zlenoargs); - metafy_line(); + zmult = -zmult; + do_menucmp(0); mselect = (*(minfo.cur))->gnum; setwish = 1; mline = -1; |