mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-09-26 14:00:50 +02:00
allow display of only messages via $compstate[list]=messages (11688)
This commit is contained in:
parent
fd25b24df6
commit
5a4253f42e
@ -1,5 +1,11 @@
|
||||
2000-05-31 Sven Wischnowsky <wischnow@zsh.org>
|
||||
|
||||
* 11688: Completion/Commands/_complete_debug,
|
||||
Completion/Core/_main_complete, Completion/Core/_setup,
|
||||
Doc/Zsh/compwid.yo, Functions/Zle/incremental-complete-word,
|
||||
Src/Zle/compcore.c, Src/Zle/complist.c, Src/Zle/compresult.c:
|
||||
allow display of only messages via $compstate[list]=messages
|
||||
|
||||
* 11549: Completion/Base/_combination, Completion/Base/_command_names,
|
||||
Completion/Base/_describe, Completion/Base/_equal,
|
||||
Completion/Base/_subscript, Completion/Base/_tilde,
|
||||
|
@ -20,7 +20,8 @@ unsetopt xtrace
|
||||
[[ -t 3 ]] && {
|
||||
print -sR "${VISUAL:-${EDITOR:-${PAGER:-more}}} $tmp ;: $w"
|
||||
_message -r "Trace output left in $tmp (up-history to view)"
|
||||
compstate[list]='list force'
|
||||
[[ $compstate[nmatches] -le 1 && $compstate[list] != *force* ]] &&
|
||||
compstate[list]='list force messages'
|
||||
exec 2>&3 3>&-
|
||||
}
|
||||
|
||||
|
@ -220,9 +220,9 @@ if [[ $compstate[old_list] = keep || nm -gt 1 ]]; then
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
elif [[ nm -eq 0 && -n "$_comp_mesg" ]]; then
|
||||
elif [[ nm -le 1 && -n "$_comp_mesg" ]]; then
|
||||
compstate[insert]=''
|
||||
compstate[list]='list force'
|
||||
compstate[list]='list force messages'
|
||||
elif [[ nm -eq 0 &&
|
||||
$#_lastdescr -ne 0 && $compstate[old_list] != keep ]] &&
|
||||
zstyle -s ":completion:${curcontext}:warnings" format format; then
|
||||
@ -251,7 +251,7 @@ fi
|
||||
|
||||
[[ "$_comp_force_list" = always ||
|
||||
( "$_comp_force_list" = ?* && nm -ge _comp_force_list ) ]] &&
|
||||
compstate[list]="$compstate[list] force"
|
||||
compstate[list]="${compstate[list]//messages} force"
|
||||
|
||||
[[ "$compstate[old_list]" = keep ]] && ZLS_COLORS="$_saved_colors"
|
||||
|
||||
|
@ -64,5 +64,5 @@ fi
|
||||
zstyle -s ":completion:${curcontext}:$1" force-list val &&
|
||||
[[ "$val" = always ||
|
||||
( "$val" = [0-9]## &&
|
||||
( -z "$_comp_force_list" || _comp_force_list -lt val ) ) ]] &&
|
||||
( -z "$_comp_force_list" || _comp_force_list -gt val ) ) ]] &&
|
||||
_comp_force_list="$val"
|
||||
|
@ -259,9 +259,12 @@ group, this group will show the tt(LIST_PACKED) behavior. The same is
|
||||
done for the tt(LIST_ROWS_FIRST) option with the substring tt(rows).
|
||||
|
||||
Finally, if the value contains the string tt(explanations), only the
|
||||
explanation strings, if any, will be listed. It will be set
|
||||
appropriately on entry to a completion widget and may be changed
|
||||
there.
|
||||
explanation strings, if any, will be listed and if it contains
|
||||
tt(messages), only the messages (added with the tt(-x) option of
|
||||
tt(compadd)) will be listed. If it contains both tt(explanations) and
|
||||
tt(messages) both kinds of explanation strings will be listed. It
|
||||
will be set appropriately on entry to a completion widget and may be
|
||||
changed there.
|
||||
)
|
||||
vindex(list_max, compstate)
|
||||
item(tt(list_max))(
|
||||
|
@ -118,7 +118,7 @@ icw-list-helper() {
|
||||
# +1 for the status line we will add...
|
||||
|
||||
if [[ compstate[list_lines]+BUFFERLINES+1 -gt LINES ]]; then
|
||||
compstate[list]='list explanations'
|
||||
compstate[list]='list explanations messages'
|
||||
[[ compstate[list_lines]+BUFFERLINES+1 -gt LINES ]] && compstate[list]=''
|
||||
|
||||
toolong='...'
|
||||
|
@ -440,7 +440,7 @@ do_completion(Hookdef dummy, Compldat dat)
|
||||
if (!showinglist && validlist && usemenu != 2 &&
|
||||
(nmatches != 1 || diffmatches) &&
|
||||
useline >= 0 && useline != 2 && (!oldlist || !listshown)) {
|
||||
onlyexpl = 1;
|
||||
onlyexpl = 3;
|
||||
showinglist = -2;
|
||||
}
|
||||
compend:
|
||||
@ -802,7 +802,8 @@ callcompfunc(char *s, char *fn)
|
||||
else
|
||||
uselist = 0;
|
||||
forcelist = (complist && strstr(complist, "force"));
|
||||
onlyexpl = (complist && strstr(complist, "expl"));
|
||||
onlyexpl = (complist ? ((strstr(complist, "expl") ? 1 : 0) |
|
||||
(strstr(complist, "messages") ? 2 : 0)) : 0);
|
||||
|
||||
if (!compinsert)
|
||||
useline = 0;
|
||||
@ -2449,7 +2450,7 @@ addexpl(void)
|
||||
|
||||
for (n = firstnode(expls); n; incnode(n)) {
|
||||
e = (Cexpl) getdata(n);
|
||||
if (!strcmp(curexpl->str, e->str)) {
|
||||
if (e->count >= 0 && !strcmp(curexpl->str, e->str)) {
|
||||
e->count += curexpl->count;
|
||||
e->fcount += curexpl->fcount;
|
||||
|
||||
@ -2471,11 +2472,11 @@ addmesg(char *mesg)
|
||||
|
||||
for (n = firstnode(expls); n; incnode(n)) {
|
||||
e = (Cexpl) getdata(n);
|
||||
if (!strcmp(mesg, e->str))
|
||||
if (e->count < 0 && !strcmp(mesg, e->str))
|
||||
return;
|
||||
}
|
||||
e = (Cexpl) zhalloc(sizeof(*e));
|
||||
e->count = e->fcount = 1;
|
||||
e->count = e->fcount = -1;
|
||||
e->str = dupstring(mesg);
|
||||
addlinknode(expls, e);
|
||||
newmatches = 1;
|
||||
|
@ -1026,7 +1026,9 @@ compprintlist(int showall)
|
||||
lastused = 1;
|
||||
}
|
||||
while (*e) {
|
||||
if ((*e)->count) {
|
||||
if ((*e)->count &&
|
||||
(!listdat.onlyexpl ||
|
||||
(listdat.onlyexpl & ((*e)->count > 0 ? 1 : 2)))) {
|
||||
if (pnl) {
|
||||
if (dolistnl(ml) && compprintnl(ml))
|
||||
goto end;
|
||||
|
@ -1170,7 +1170,8 @@ comp_list(char *v)
|
||||
zsfree(complist);
|
||||
complist = ztrdup(v);
|
||||
|
||||
onlyexpl = (v && strstr(v, "expl"));
|
||||
onlyexpl = (v ? ((strstr(v, "expl") ? 1 : 0) |
|
||||
(strstr(v, "messages") ? 2 : 0)) : 0);
|
||||
}
|
||||
|
||||
/* This skips over matches that are not to be listed. */
|
||||
@ -1300,7 +1301,9 @@ calclist(int showall)
|
||||
}
|
||||
if ((e = g->expls)) {
|
||||
while (*e) {
|
||||
if ((*e)->count)
|
||||
if ((*e)->count &&
|
||||
(!onlyexpl ||
|
||||
(onlyexpl & ((*e)->count > 0 ? 1 : 2))))
|
||||
nlines += 1 + printfmt((*e)->str, (*e)->count, 0, 1);
|
||||
e++;
|
||||
}
|
||||
@ -1690,7 +1693,9 @@ printlist(int over, CLPrintFunc printm, int showall)
|
||||
int l;
|
||||
|
||||
while (*e) {
|
||||
if ((*e)->count) {
|
||||
if ((*e)->count &&
|
||||
(!listdat.onlyexpl ||
|
||||
(listdat.onlyexpl & ((*e)->count > 0 ? 1 : 2)))) {
|
||||
if (pnl) {
|
||||
putc('\n', shout);
|
||||
pnl = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user