mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-27 14:45:13 +08:00
complete: replace confusing comment with test case
This commit is contained in:
parent
75fa3b6bae
commit
9a355d5482
@ -665,12 +665,7 @@ static wcstring complete_function_desc(const wcstring &fn) {
|
|||||||
bool has_description = function_get_desc(fn, result);
|
bool has_description = function_get_desc(fn, result);
|
||||||
if (!has_description) {
|
if (!has_description) {
|
||||||
function_get_definition(fn, result);
|
function_get_definition(fn, result);
|
||||||
// Consider complete -a '(complete -C "prefix")':
|
// A completion description is a single line.
|
||||||
// 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.
|
|
||||||
for (wchar_t &c : result) {
|
for (wchar_t &c : result) {
|
||||||
if (c == L'\n') c = L' ';
|
if (c == L'\n') c = L' ';
|
||||||
}
|
}
|
||||||
|
@ -153,3 +153,11 @@ complete -C'function : --arg'
|
|||||||
|
|
||||||
complete -C'echo > /' | string length -q && echo ok
|
complete -C'echo > /' | string length -q && echo ok
|
||||||
# CHECK: 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…
x
Reference in New Issue
Block a user