Fix the build when gettext is disabled

When gettext is disabled, completions descriptions get passed as
const wcstring & which breaks the build. Accept the descriptions
by value instead.
This commit is contained in:
ridiculousfish 2020-12-05 14:26:07 -08:00
parent 91503151c9
commit fbeff2e751
2 changed files with 5 additions and 3 deletions

View File

@ -248,7 +248,7 @@ bool completion_receiver_t::add(wcstring &&comp) {
return this->add(std::move(comp), wcstring{});
}
bool completion_receiver_t::add(wcstring &&comp, wcstring &&desc, complete_flags_t flags,
bool completion_receiver_t::add(wcstring &&comp, wcstring desc, complete_flags_t flags,
string_fuzzy_match_t match) {
return this->add(completion_t(std::move(comp), std::move(desc), match, flags));
}

View File

@ -144,8 +144,10 @@ class completion_receiver_t {
/// Add a completion with the given string, description, flags, and fuzzy match.
/// \return true on success, false if this would overflow the limit.
__warn_unused bool add(wcstring &&comp, wcstring &&desc, complete_flags_t flags = 0,
string_fuzzy_match_t match = string_fuzzy_match_t::exact_match());
/// The 'desc' parameter is not && because if gettext is not enabled, then we end
/// up passing a 'const wcstring &' here.
__warn_unused bool add(wcstring &&comp, wcstring desc, complete_flags_t flags = 0,
string_fuzzy_match_t match = string_fuzzy_match_t::exact_match());
/// Add a list of completions.
/// \return true on success, false if this would overflow the limit.