Switch completion_request_options_t from a list of flags to a struct

This is simpler and allows potentially hanging more fields off of it
later.
This commit is contained in:
ridiculousfish
2022-06-07 19:37:31 -07:00
parent 1819c7f2b8
commit 17bd7d0e40
5 changed files with 53 additions and 57 deletions

View File

@@ -1777,7 +1777,7 @@ static std::function<autosuggestion_t(void)> get_autosuggestion_performer(
if (std::wcschr(L"'\"", last_char) && cursor_at_end) return nothing;
// Try normal completions.
completion_request_flags_t complete_flags = completion_request_t::autosuggestion;
completion_request_options_t complete_flags = completion_request_options_t::autosuggest();
completion_list_t completions = complete(search_string, complete_flags, ctx);
completions_sort_and_prioritize(&completions, complete_flags);
if (!completions.empty()) {
@@ -2892,9 +2892,7 @@ void reader_data_t::compute_and_apply_completions(readline_cmd_t c, readline_loo
// Ensure that `commandline` inside the completions gets the current state.
update_commandline_state();
completion_request_flags_t complete_flags = {completion_request_t::descriptions,
completion_request_t::fuzzy_match};
rls.comp = complete(buffcpy, complete_flags, parser_ref->context());
rls.comp = complete(buffcpy, completion_request_options_t::normal(), parser_ref->context());
// User-supplied completions may have changed the commandline - prevent buffer
// overflow.