From aa7fe3b1322e5cc912d6b132b7738a6c46b24046 Mon Sep 17 00:00:00 2001 From: Kevin Ballard Date: Tue, 2 Sep 2014 14:51:40 -0700 Subject: [PATCH] Don't erase all long opts with `complete -e` When using `complete -c foo -l bar -e`, all long options for the command were being erased because it was also comparing the short option, which was 0. --- complete.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/complete.cpp b/complete.cpp index 8ede1eb22..3cdffab9e 100644 --- a/complete.cpp +++ b/complete.cpp @@ -630,7 +630,8 @@ bool completion_entry_t::remove_option(wchar_t short_opt, const wchar_t *long_op for (option_list_t::iterator iter = this->options.begin(); iter != this->options.end();) { complete_entry_opt_t &o = *iter; - if (short_opt==o.short_opt || (long_opt && long_opt == o.long_opt)) + if ((short_opt && short_opt == o.short_opt) || + (long_opt && long_opt == o.long_opt)) { /* fwprintf( stderr, L"remove option -%lc --%ls\n",