mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-30 19:20:53 +02:00
37961: fix crash on bad memory access
In interactive menuselection, use of "compadd -x" (e.g. the "warnings" zstyle) may have replaced the completion list, so skip highlighting of the current selection until a subsequent keystroke has regenerated the original listing
This commit is contained in:
parent
1b923f69c7
commit
f07a1bd009
2 changed files with 30 additions and 8 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2016-02-14 Barton E. Schaefer <schaefer@zsh.org>
|
||||||
|
|
||||||
|
* 37961: Src/Zle/complist.c: in interactive menuselection, use of
|
||||||
|
"compadd -x" (e.g. the "warnings" zstyle) may have replaced the
|
||||||
|
completion list, so skip highlighting of the current selection
|
||||||
|
until a subsequent keystroke has regenerated the original listing;
|
||||||
|
fixes crash on bad memory access
|
||||||
|
|
||||||
2016-02-11 Eric Cook <llua@gmx.com>
|
2016-02-11 Eric Cook <llua@gmx.com>
|
||||||
|
|
||||||
* 37913: Completion/BSD/Command/_gstat,
|
* 37913: Completion/BSD/Command/_gstat,
|
||||||
|
|
|
@ -34,8 +34,9 @@
|
||||||
/* Information about the list shown. */
|
/* Information about the list shown. */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* noselect: 1 if complistmatches indicated we shouldn't do selection.
|
* noselect: 1 if complistmatches indicated we shouldn't do selection;
|
||||||
* Tested in domenuselect.
|
* -1 if interactive mode needs to reset the selection list.
|
||||||
|
* Tested in domenuselect, and in complistmatches to skip redraw.
|
||||||
* mselect: Local copy of the index of the currently selected match.
|
* mselect: Local copy of the index of the currently selected match.
|
||||||
* Initialised to the gnum entry of the current match for
|
* Initialised to the gnum entry of the current match for
|
||||||
* each completion.
|
* each completion.
|
||||||
|
@ -1980,6 +1981,7 @@ complistmatches(UNUSED(Hookdef dummy), Chdata dat)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (noselect > 0)
|
||||||
noselect = 0;
|
noselect = 0;
|
||||||
|
|
||||||
if ((minfo.asked == 2 && mselect < 0) || nlnct >= zterm_lines) {
|
if ((minfo.asked == 2 && mselect < 0) || nlnct >= zterm_lines) {
|
||||||
|
@ -2078,9 +2080,11 @@ complistmatches(UNUSED(Hookdef dummy), Chdata dat)
|
||||||
last_cap = (char *) zhalloc(max_caplen + 1);
|
last_cap = (char *) zhalloc(max_caplen + 1);
|
||||||
*last_cap = '\0';
|
*last_cap = '\0';
|
||||||
|
|
||||||
if (!mnew && inselect && onlnct == nlnct && mlbeg >= 0 && mlbeg == molbeg)
|
if (!mnew && inselect &&
|
||||||
|
onlnct == nlnct && mlbeg >= 0 && mlbeg == molbeg) {
|
||||||
|
if (!noselect)
|
||||||
singledraw();
|
singledraw();
|
||||||
else if (!compprintlist(mselect >= 0) || !clearflag)
|
} else if (!compprintlist(mselect >= 0) || !clearflag)
|
||||||
noselect = 1;
|
noselect = 1;
|
||||||
|
|
||||||
onlnct = nlnct;
|
onlnct = nlnct;
|
||||||
|
@ -2093,7 +2097,7 @@ complistmatches(UNUSED(Hookdef dummy), Chdata dat)
|
||||||
popheap();
|
popheap();
|
||||||
opts[EXTENDEDGLOB] = extendedglob;
|
opts[EXTENDEDGLOB] = extendedglob;
|
||||||
|
|
||||||
return noselect;
|
return (noselect < 0 ? 0 : noselect);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -2547,14 +2551,23 @@ domenuselect(Hookdef dummy, Chdata dat)
|
||||||
} else {
|
} else {
|
||||||
statusline = NULL;
|
statusline = NULL;
|
||||||
}
|
}
|
||||||
|
if (noselect < 0) {
|
||||||
|
showinglist = clearlist = 0;
|
||||||
|
clearflag = 1;
|
||||||
|
}
|
||||||
zrefresh();
|
zrefresh();
|
||||||
statusline = NULL;
|
statusline = NULL;
|
||||||
inselect = 1;
|
inselect = 1;
|
||||||
|
selected = 1;
|
||||||
if (noselect) {
|
if (noselect) {
|
||||||
|
if (noselect < 0) {
|
||||||
|
/* no selection until after processing keystroke */
|
||||||
|
noselect = 0;
|
||||||
|
goto getk;
|
||||||
|
}
|
||||||
broken = 1;
|
broken = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
selected = 1;
|
|
||||||
if (!i) {
|
if (!i) {
|
||||||
i = mcols * mlines;
|
i = mcols * mlines;
|
||||||
while (i--)
|
while (i--)
|
||||||
|
@ -2752,6 +2765,7 @@ domenuselect(Hookdef dummy, Chdata dat)
|
||||||
if (nmessages) {
|
if (nmessages) {
|
||||||
showinglist = -2;
|
showinglist = -2;
|
||||||
zrefresh();
|
zrefresh();
|
||||||
|
noselect = -1;
|
||||||
} else {
|
} else {
|
||||||
trashzle();
|
trashzle();
|
||||||
zsetterm();
|
zsetterm();
|
||||||
|
|
Loading…
Reference in a new issue