mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-14 14:03:58 +00:00
complete: replace confusing comment with test case
This commit is contained in:
parent
75fa3b6bae
commit
9a355d5482
2 changed files with 9 additions and 6 deletions
|
@ -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' ';
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue