From 9a355d54827c75bd43f33168b5ef54c579668989 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Wed, 8 Jan 2020 17:53:46 +0100 Subject: [PATCH] complete: replace confusing comment with test case --- src/complete.cpp | 7 +------ tests/checks/complete.fish | 8 ++++++++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/complete.cpp b/src/complete.cpp index 128e591b0..d496dc689 100644 --- a/src/complete.cpp +++ b/src/complete.cpp @@ -665,12 +665,7 @@ static wcstring complete_function_desc(const wcstring &fn) { bool has_description = function_get_desc(fn, result); if (!has_description) { function_get_definition(fn, result); - // Consider complete -a '(complete -C "prefix")': - // If some functions whose name starts with prefix and whose - // definition includes a line that starts with prefix, this line - // would be suggested as completion. - // Replace newlines by spaces to avoid these excess lines. - // The completion description will be shown in one line regardless. + // A completion description is a single line. for (wchar_t &c : result) { if (c == L'\n') c = L' '; } diff --git a/tests/checks/complete.fish b/tests/checks/complete.fish index 2f4469626..2e6a953f2 100644 --- a/tests/checks/complete.fish +++ b/tests/checks/complete.fish @@ -153,3 +153,11 @@ complete -C'function : --arg' complete -C'echo > /' | string length -q && echo ok # CHECK: ok + +function some_function + echo line1 + echo line2 +end +complete -c complete_test_function_desc -xa '(complete -Csome_function)' +complete -C'complete_test_function_desc ' | count +# CHECK: 1