Add early abortion of completion match attempt

This commit is contained in:
Mahmoud Al-Qudsi 2020-07-06 23:08:19 -05:00
parent 0b3b4f3d91
commit 8d25ed962c

View File

@ -1053,10 +1053,12 @@ bool completer_t::complete_param(const wcstring &cmd_orig, const wcstring &popt,
wcstring whole_opt(o.expected_dash_count(), L'-');
whole_opt.append(o.option);
if (whole_opt.length() < str.length()) {
continue;
}
int match = string_prefixes_string(str, whole_opt);
if (!match) {
bool match_no_case = wcsncasecmp(str.c_str(), whole_opt.c_str(), str.length()) == 0;
if (!match_no_case) {
continue;
}