diff options
Diffstat (limited to 'Src')
-rw-r--r-- | Src/Zle/compcore.c | 3 | ||||
-rw-r--r-- | Src/Zle/complete.c | 14 | ||||
-rw-r--r-- | Src/Zle/complist.c | 30 | ||||
-rw-r--r-- | Src/Zle/compresult.c | 8 | ||||
-rw-r--r-- | Src/params.c | 2 |
5 files changed, 30 insertions, 27 deletions
diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c index 0c989c427..0ecd7da79 100644 --- a/Src/Zle/compcore.c +++ b/Src/Zle/compcore.c @@ -296,8 +296,7 @@ do_completion(Hookdef dummy, Compldat dat) comppatinsert = ztrdup("menu"); forcelist = 0; haspattern = 0; - zsfree(complistmax); - complistmax = ztrdup(getsparam("LISTMAX")); + complistmax = getiparam("LISTMAX"); zsfree(complastprompt); complastprompt = ztrdup(((isset(ALWAYSLASTPROMPT) && zmult == 1) || (unset(ALWAYSLASTPROMPT) && zmult != 1)) ? diff --git a/Src/Zle/complete.c b/Src/Zle/complete.c index 2746f52d3..25a33b9cb 100644 --- a/Src/Zle/complete.c +++ b/Src/Zle/complete.c @@ -33,7 +33,9 @@ /* global variables for shell parameters in new style completion */ /**/ -mod_export zlong compcurrent; +mod_export +zlong compcurrent, + complistmax; /**/ zlong complistlines, compignored; @@ -49,8 +51,7 @@ char **compwords, *compquote, *compqstack, *comppatmatch, - *complastprompt, - *complistmax; + *complastprompt; /**/ char *compiprefix, *compcontext, @@ -924,7 +925,7 @@ static struct compparam compkparams[] = { { "unambiguous", PM_SCALAR | PM_READONLY, NULL, NULL, VAL(get_unambig) }, { "unambiguous_cursor", PM_INTEGER | PM_READONLY, NULL, NULL, VAL(get_unambig_curs) }, - { "list_max", PM_SCALAR, VAL(complistmax), NULL, NULL }, + { "list_max", PM_INTEGER, VAL(complistmax), NULL, NULL }, { "last_prompt", PM_SCALAR, VAL(complastprompt), NULL, NULL }, { "to_end", PM_SCALAR, VAL(comptoend), NULL, NULL }, { "old_list", PM_SCALAR, VAL(compoldlist), NULL, NULL }, @@ -1312,13 +1313,13 @@ setup_(Module m) comprpms = compkpms = NULL; compwords = NULL; compprefix = compsuffix = compiprefix = compisuffix = - compqiprefix = compqisuffix = complistmax = + compqiprefix = compqisuffix = compcontext = compparameter = compredirect = compquote = compquoting = comprestore = complist = compinsert = compexact = compexactstr = comppatmatch = comppatinsert = complastprompt = comptoend = compoldlist = compoldins = compvared = compqstack = NULL; - + complistmax = 0; hascompmod = 1; return 0; @@ -1367,7 +1368,6 @@ finish_(Module m) { if (compwords) freearray(compwords); - zsfree(complistmax); zsfree(compprefix); zsfree(compsuffix); zsfree(compiprefix); diff --git a/Src/Zle/complist.c b/Src/Zle/complist.c index 045517a6d..55887b1de 100644 --- a/Src/Zle/complist.c +++ b/Src/Zle/complist.c @@ -384,7 +384,7 @@ getcols(Listcols c) static int noselect, mselect, inselect, mcol, mline, mcols, mlines, mmlen; static int selected, mlbeg = -1, mlend = 9999999, mscroll, mrestlines; static int mnew, mlastcols, mlastlines, mhasstat, mfirstl, mlastm; -static char *mstatus; +static char *mstatus, *mlistp; static Cmatch **mtab, **mmtabp; static Cmgroup *mgtab, *mgtabp; static struct listcols mcolors; @@ -730,8 +730,8 @@ compprintfmt(char *fmt, int n, int dopr, int doesc, int ml, int *stop) if (!(fmt = mstatus)) return 0; cc = -1; - } else if (!(fmt = getsparam("LISTPROMPT"))) - fmt = "Continue? "; + } else + fmt = mlistp; } for (p = fmt; *p; p++) { if (doesc && *p == '%') { @@ -1437,7 +1437,6 @@ static int complistmatches(Hookdef dummy, Chdata dat) { Cmgroup oamatches = amatches; - char *p = NULL; amatches = dat->matches; @@ -1463,24 +1462,30 @@ complistmatches(Hookdef dummy, Chdata dat) clearflag = 0; mscroll = 0; + mlistp = NULL; if (mselect >= 0 || mlbeg >= 0 || - ((p = complistmax) && !strcmp(p, "scroll"))) { + (mlistp = getsparam("LISTPROMPT"))) { + if (!*mlistp) + mlistp = "%SAt %p: Hit TAB for more, or the character to insert%s"; trashzle(); showinglist = listshown = 0; lastlistlen = 0; - if (p) { + if (mlistp) { clearflag = (isset(USEZLE) && !termflags && dolastprompt); mscroll = 1; } else { clearflag = 1; minfo.asked = (listdat.nlines + nlnct <= lines); } - } else if (asklist()) { - amatches = oamatches; - return (noselect = 1); + } else { + mlistp = NULL; + if (asklist()) { + amatches = oamatches; + return (noselect = 1); + } } if (mlbeg >= 0) { mlend = mlbeg + lines - nlnct - mhasstat; @@ -1569,7 +1574,7 @@ domenuselect(Hookdef dummy, Chdata dat) int space, lbeg = 0, step = 1; char *s; - if (fdat || (dummy && (!(s = getsparam("SELECTMIN")) || + if (fdat || (dummy && (!(s = getsparam("MENUSELECT")) || (dat && dat->num < atoi(s))))) { if (fdat) { fdat->matches = dat->matches; @@ -1577,14 +1582,15 @@ domenuselect(Hookdef dummy, Chdata dat) } return 0; } - if ((s = getsparam("SELECTSCROLL"))) { + if ((s = getsparam("MENUSCROLL"))) { if (!(step = mathevali(s))) step = (lines - nlnct) >> 1; else if (step < 0) if ((step += lines - nlnct) < 0) step = 1; } - mstatus = getsparam("SELECTPROMPT"); + if ((mstatus = getsparam("MENUPROMPT")) && !*mstatus) + mstatus = "%SScrolling active: current selection at %p%s"; mhasstat = (mstatus && *mstatus); fdat = dat; selectlocalmap(mskeymap); diff --git a/Src/Zle/compresult.c b/Src/Zle/compresult.c index f40ee6724..c804fdcf2 100644 --- a/Src/Zle/compresult.c +++ b/Src/Zle/compresult.c @@ -1590,8 +1590,6 @@ calclist(int showall) mod_export int asklist(void) { - int lmax = (complistmax ? (int) mathevali(complistmax) : 0); - /* Set the cursor below the prompt. */ trashzle(); showinglist = listshown = 0; @@ -1601,9 +1599,9 @@ asklist(void) /* Maybe we have to ask if the user wants to see the list. */ if ((!minfo.cur || !minfo.asked) && - ((lmax > 0 && listdat.nlist >= lmax) || - (lmax < 0 && listdat.nlines <= -lmax) || - (!lmax && listdat.nlines >= lines))) { + ((complistmax > 0 && listdat.nlist >= complistmax) || + (complistmax < 0 && listdat.nlines <= -complistmax) || + (!complistmax && listdat.nlines >= lines))) { int qup, l; zsetterm(); diff --git a/Src/params.c b/Src/params.c index 79bc5e9a9..74c4ee1c8 100644 --- a/Src/params.c +++ b/Src/params.c @@ -483,10 +483,10 @@ createparamtable(void) setiparam("MAILCHECK", 60); setiparam("LOGCHECK", 60); setiparam("KEYTIMEOUT", 40); + setiparam("LISTMAX", 100); #ifdef HAVE_SELECT setiparam("BAUD", getbaudrate(&shttyinfo)); /* get the output baudrate */ #endif - setsparam("LISTMAX", ztrdup("100")); setsparam("FCEDIT", ztrdup(DEFAULT_FCEDIT)); setsparam("TMPPREFIX", ztrdup(DEFAULT_TMPPREFIX)); setsparam("TIMEFMT", ztrdup(DEFAULT_TIMEFMT)); |