From 8d25ed962cc9bc4cc7ae625bfca173ef970503a0 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Mon, 6 Jul 2020 23:08:19 -0500 Subject: [PATCH] Add early abortion of completion match attempt --- src/complete.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/complete.cpp b/src/complete.cpp index ba245581a..d4ae0ee9c 100644 --- a/src/complete.cpp +++ b/src/complete.cpp @@ -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; }