Don't erase old-style options with complete -l foo -e

When erasing long option completions, distinguish between gnu-style and
old-style options, just like we do when adding and printing completions.
This commit is contained in:
Kevin Ballard
2014-09-02 14:53:19 -07:00
parent aa7fe3b132
commit edd4f3d5ad
3 changed files with 22 additions and 13 deletions

View File

@@ -173,14 +173,16 @@ static void builtin_complete_add(const wcstring_list_t &cmd,
static void builtin_complete_remove3(const wchar_t *cmd,
int cmd_type,
wchar_t short_opt,
const wcstring_list_t &long_opt)
const wcstring_list_t &long_opt,
int long_mode)
{
for (size_t i=0; i<long_opt.size(); i++)
{
complete_remove(cmd,
cmd_type,
short_opt,
long_opt.at(i).c_str());
long_opt.at(i).c_str(),
long_mode);
}
}
@@ -203,6 +205,7 @@ static void builtin_complete_remove2(const wchar_t *cmd,
complete_remove(cmd,
cmd_type,
*s,
0,
0);
}
@@ -211,11 +214,13 @@ static void builtin_complete_remove2(const wchar_t *cmd,
builtin_complete_remove3(cmd,
cmd_type,
*s,
gnu_opt);
gnu_opt,
0);
builtin_complete_remove3(cmd,
cmd_type,
*s,
old_opt);
old_opt,
1);
}
}
}
@@ -224,11 +229,13 @@ static void builtin_complete_remove2(const wchar_t *cmd,
builtin_complete_remove3(cmd,
cmd_type,
0,
gnu_opt);
gnu_opt,
0);
builtin_complete_remove3(cmd,
cmd_type,
0,
old_opt);
old_opt,
1);
}