summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2014-10-29 08:45:57 -0700
committerBarton E. Schaefer <schaefer@zsh.org>2014-10-29 08:45:57 -0700
commit691547cda60f0512c645e80246292936e660f326 (patch)
tree4462acf2ff7debdd7438e4dff3c36f82cfb1d598
parent0412c0baaa8aab99dc59913614f42471091712b0 (diff)
downloadzsh-691547cda60f0512c645e80246292936e660f326.tar.gz
zsh-691547cda60f0512c645e80246292936e660f326.zip
33563: Completion/Base/Core/_main_complete, Src/Zle/complist.c: fix thinko in status message for INT/QUIT signals; check errflag in output loops
Two semi-related patches for keyboard interrupt handling in completion, most importantly so that unexpectedly long completion listings can be interrupted.
-rw-r--r--ChangeLog7
-rw-r--r--Completion/Base/Core/_main_complete2
-rw-r--r--Src/Zle/complist.c12
3 files changed, 14 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 54fac61ca..676d26979 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2014-10-29 Barton E. Schaefer <schaefer@zsh.org>
+
+ * 33563: Completion/Base/Core/_main_complete, Src/Zle/complist.c:
+ fix thinko in status message for INT/QUIT signals; check errflag
+ in output loops so that unexpectedly long completion listings can
+ be interrupted
+
2014-10-26 Peter Stephenson <p.w.stephenson@ntlworld.com>
* 33564: Test/A05execution.ztst: more care with monitor option.
diff --git a/Completion/Base/Core/_main_complete b/Completion/Base/Core/_main_complete
index e881ea6a1..fcd63664e 100644
--- a/Completion/Base/Core/_main_complete
+++ b/Completion/Base/Core/_main_complete
@@ -128,7 +128,7 @@ _completer_num=1
# We assume localtraps to be in effect here ...
integer SECONDS=0
-trap 'zle -M "Killed by signal in ${funcstack[0]} after ${SECONDS}s";
+trap 'zle -M "Killed by signal in ${funcstack[1]} after ${SECONDS}s";
zle -R; return 130' INT QUIT
# Call the pre-functions.
diff --git a/Src/Zle/complist.c b/Src/Zle/complist.c
index 5e5ba9f20..2e1a5273c 100644
--- a/Src/Zle/complist.c
+++ b/Src/Zle/complist.c
@@ -1375,7 +1375,7 @@ compprintlist(int showall)
tcout(TCCLEAREOD);
g = ((lasttype && lastg) ? lastg : amatches);
- while (g) {
+ while (g && !errflag) {
char **pp = g->ylist;
#ifdef ZSH_HEAP_DEBUG
@@ -1389,7 +1389,7 @@ compprintlist(int showall)
ml = lastml;
lastused = 1;
}
- while (*e) {
+ while (*e && !errflag) {
if (((*e)->count || (*e)->always) &&
(!listdat.onlyexpl ||
(listdat.onlyexpl & ((*e)->always > 0 ? 2 : 1)))) {
@@ -1469,11 +1469,11 @@ compprintlist(int showall)
nl = nc = g->lins;
- while (n && nl--) {
+ while (n && nl-- && !errflag) {
i = g->cols;
mc = 0;
pq = pp;
- while (n && i--) {
+ while (n && i-- && !errflag) {
if (pq - g->ylist >= g->lcount)
break;
if (compzputs(*pq, mscroll))
@@ -1582,7 +1582,7 @@ compprintlist(int showall)
} else
p = skipnolist(g->matches, showall);
- while (n && nl--) {
+ while (n && nl-- && !errflag) {
if (!lasttype && ml >= mlbeg) {
lasttype = 3;
lastg = g;
@@ -1596,7 +1596,7 @@ compprintlist(int showall)
i = g->cols;
mc = 0;
q = p;
- while (n && i--) {
+ while (n && i-- && !errflag) {
wid = (g->widths ? g->widths[mc] : g->width);
if (!(m = *q)) {
if (clprintm(g, NULL, mc, ml, (!i), wid))