mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-24 14:23:52 +08:00
Revert "Fix completion descriptions for functions"
This reverts commit 9c63ad3209
until I can
figure out what is causing the assertion and test failures.
It *seems* to be that passing in the correct function name to the
description lookup is causing a previously present error to be realized,
but I can't yet be certain.
This commit is contained in:
parent
9c63ad3209
commit
2db759813d
|
@ -119,8 +119,7 @@ static enum fuzzy_match_type_t wildcard_match_internal(const wchar_t *str, const
|
||||||
return fuzzy_match_none;
|
return fuzzy_match_none;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Common case of * at the end. In that case we can early out since we know it will
|
// Common case of * at the end. In that case we can early out since we know it will match.
|
||||||
// match.
|
|
||||||
if (wc_x[1] == L'\0') {
|
if (wc_x[1] == L'\0') {
|
||||||
return fuzzy_match_exact;
|
return fuzzy_match_exact;
|
||||||
}
|
}
|
||||||
|
@ -157,8 +156,7 @@ static enum fuzzy_match_type_t wildcard_match_internal(const wchar_t *str, const
|
||||||
}
|
}
|
||||||
|
|
||||||
// This does something horrible refactored from an even more horrible function.
|
// This does something horrible refactored from an even more horrible function.
|
||||||
static wcstring resolve_description(const wchar_t *full_completion, wcstring *completion,
|
static wcstring resolve_description(wcstring *completion, const wchar_t *explicit_desc,
|
||||||
const wchar_t *explicit_desc,
|
|
||||||
wcstring (*desc_func)(const wcstring &)) {
|
wcstring (*desc_func)(const wcstring &)) {
|
||||||
size_t complete_sep_loc = completion->find(PROG_COMPLETE_SEP);
|
size_t complete_sep_loc = completion->find(PROG_COMPLETE_SEP);
|
||||||
if (complete_sep_loc != wcstring::npos) {
|
if (complete_sep_loc != wcstring::npos) {
|
||||||
|
@ -168,7 +166,7 @@ static wcstring resolve_description(const wchar_t *full_completion, wcstring *co
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
const wcstring func_result = (desc_func ? desc_func(full_completion) : wcstring());
|
const wcstring func_result = (desc_func ? desc_func(*completion) : wcstring());
|
||||||
if (!func_result.empty()) {
|
if (!func_result.empty()) {
|
||||||
return func_result;
|
return func_result;
|
||||||
}
|
}
|
||||||
|
@ -243,8 +241,7 @@ static bool wildcard_complete_internal(const wchar_t *str, const wchar_t *wc,
|
||||||
// the wildcard.
|
// the wildcard.
|
||||||
assert(!full_replacement || wcslen(wc) <= wcslen(str));
|
assert(!full_replacement || wcslen(wc) <= wcslen(str));
|
||||||
wcstring out_completion = full_replacement ? params.orig : str + wcslen(wc);
|
wcstring out_completion = full_replacement ? params.orig : str + wcslen(wc);
|
||||||
wcstring out_desc =
|
wcstring out_desc = resolve_description(&out_completion, params.desc, params.desc_func);
|
||||||
resolve_description(str, &out_completion, params.desc, params.desc_func);
|
|
||||||
|
|
||||||
// Note: out_completion may be empty if the completion really is empty, e.g. tab-completing
|
// Note: out_completion may be empty if the completion really is empty, e.g. tab-completing
|
||||||
// 'foo' when a file 'foo' exists.
|
// 'foo' when a file 'foo' exists.
|
||||||
|
@ -326,8 +323,8 @@ bool wildcard_complete(const wcstring &str, const wchar_t *wc, const wchar_t *de
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wildcard_match(const wcstring &str, const wcstring &wc, bool leading_dots_fail_to_match) {
|
bool wildcard_match(const wcstring &str, const wcstring &wc, bool leading_dots_fail_to_match) {
|
||||||
enum fuzzy_match_type_t match =
|
enum fuzzy_match_type_t match = wildcard_match_internal(
|
||||||
wildcard_match_internal(str.c_str(), wc.c_str(), leading_dots_fail_to_match);
|
str.c_str(), wc.c_str(), leading_dots_fail_to_match);
|
||||||
return match != fuzzy_match_none;
|
return match != fuzzy_match_none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -430,8 +427,7 @@ static bool wildcard_test_flags_then_complete(const wcstring &filepath, const wc
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_windows_subsystem_for_linux() &&
|
if (is_windows_subsystem_for_linux() && string_suffixes_string_case_insensitive(L".dll", filename)) {
|
||||||
string_suffixes_string_case_insensitive(L".dll", filename)) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user