Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Interrupting globs (Re: Something rotten in tar completion)
(Note, two competing patches herein, do not apply both.)
On Dec 5, 8:34pm, Peter Stephenson wrote:
}
} The trap goes back to zsh-workers/32322 (it got modified later but that
} was largely cosmetic). The rationale there, it appears, was it was
} making difficulties in interrupting easier to test (by displaying the
} message, I presume) --- not that it was fixing anything. So as far as I
} can see the underlying complaint was the same as mine, to return the
} shell to the point where I get control of the command line as soon as
} possible. Am I missing something?
No, I'd forgotten the exact circumstances. However, as I mentioned in
another part of the thread, there's something I missed as well, which
is that if you ^C all the way out of _main_complete, some interesting
(if not always important) bits of state don't get restored.
If we stick with the TRAPINT(), then we need this ...
diff --git a/Completion/Base/Core/_main_complete b/Completion/Base/Core/_main_complete
index 91b68fe..bc63e83 100644
--- a/Completion/Base/Core/_main_complete
+++ b/Completion/Base/Core/_main_complete
@@ -129,7 +129,7 @@ _completer_num=1
# We assume localtraps to be in effect here ...
integer SECONDS=0
TRAPINT TRAPQUIT() {
- zle -M "Killed by signal in ${funcstack[1]} after ${SECONDS}s";
+ zle -M "Killed by signal in ${funcstack[2]} after ${SECONDS}s";
zle -R
return 130
}
... and we also need an always-block or something to cover cleanup,
which may mean rearranging other parts of _main_complete.
Or we could do this, which stops the matcher-list and completer loops
(and any tag loops or the like that are also in play) and then does
the rest of _main_complete as usual:
diff --git a/Completion/Base/Core/_main_complete
b/Completion/Base/Core/_main_complete
index 91b68fe..5c4e368 100644
--- a/Completion/Base/Core/_main_complete
+++ b/Completion/Base/Core/_main_complete
@@ -126,13 +126,14 @@ fi
_completer_num=1
-# We assume localtraps to be in effect here ...
-integer SECONDS=0
-TRAPINT TRAPQUIT() {
+# We assume localtraps and no_localloops to be in effect here ...
+float SECONDS=0
+trap '
zle -M "Killed by signal in ${funcstack[1]} after ${SECONDS}s";
zle -R
+ repeat 1 break 10000 # break out of any reasonable number of loops
return 130
-}
+' INT QUIT
# Call the pre-functions.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author