mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 21:33:09 +00:00
Raise the recursion limit of complete
Users should generally prefer to use complete --wraps but this corrects some unexpected behavior. Fixes #3474
This commit is contained in:
parent
aa011f70a8
commit
e167714899
3 changed files with 24 additions and 4 deletions
|
@ -337,7 +337,7 @@ int builtin_complete(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
|
|||
cleanup_t remove_transient([&] { parser.libdata().transient_commandlines.pop_back(); });
|
||||
|
||||
// Allow a limited number of recursive calls to complete (#3474).
|
||||
if (parser.libdata().builtin_complete_recursion_level >= 1) {
|
||||
if (parser.libdata().builtin_complete_recursion_level >= 24) {
|
||||
streams.err.append_format(L"%ls: maximum recursive depth reached\n", cmd);
|
||||
} else {
|
||||
parser.libdata().builtin_complete_recursion_level++;
|
||||
|
|
|
@ -64,4 +64,27 @@ complete
|
|||
complete -c complete_test_recurse1 -xa '(echo recursing 1>&2; complete -C"complete_test_recurse1 ")'
|
||||
complete -C'complete_test_recurse1 '
|
||||
# CHECKERR: recursing
|
||||
# CHECKERR: recursing
|
||||
# CHECKERR: recursing
|
||||
# CHECKERR: recursing
|
||||
# CHECKERR: recursing
|
||||
# CHECKERR: recursing
|
||||
# CHECKERR: recursing
|
||||
# CHECKERR: recursing
|
||||
# CHECKERR: recursing
|
||||
# CHECKERR: recursing
|
||||
# CHECKERR: recursing
|
||||
# CHECKERR: recursing
|
||||
# CHECKERR: recursing
|
||||
# CHECKERR: recursing
|
||||
# CHECKERR: recursing
|
||||
# CHECKERR: recursing
|
||||
# CHECKERR: recursing
|
||||
# CHECKERR: recursing
|
||||
# CHECKERR: recursing
|
||||
# CHECKERR: recursing
|
||||
# CHECKERR: recursing
|
||||
# CHECKERR: recursing
|
||||
# CHECKERR: recursing
|
||||
# CHECKERR: recursing
|
||||
# CHECKERR: complete: maximum recursive depth reached
|
||||
|
|
|
@ -19,13 +19,10 @@ function testcommand2_complete
|
|||
set -l tokens (commandline -opc) (commandline -ct)
|
||||
set -e tokens[1]
|
||||
echo $tokens 1>&2
|
||||
complete -C"$tokens"
|
||||
end
|
||||
|
||||
complete -c testcommand2 -x -a "(testcommand2_complete)"
|
||||
complete -c testcommand2 --wraps "testcommand2 from_wraps "
|
||||
complete -C'testcommand2 explicit '
|
||||
# CHECKERR: explicit
|
||||
# CHECKERR: complete: maximum recursive depth reached
|
||||
# CHECKERR: from_wraps explicit
|
||||
# CHECKERR: complete: maximum recursive depth reached
|
||||
|
|
Loading…
Reference in a new issue