wcsfilecmp: sort - after everything else

Before this change, - was sorted with other punctuation before
A-Z. Now, it sorts above the rest of the characters.

This has a practical effect on completions, where when there are
both -s and --long with the same description, the short option
is now before the long option in the pager, which is what is now
selected when navigating `foo -<TAB>`. The long options can be
picked out with `foo --<TAB>`. Before, short options which
duplicated a long option literally could not be selected by
any means from the pager.

Fixes #5634
This commit is contained in:
Aaron Gyes 2019-03-16 01:08:21 -07:00
parent 74a22ff426
commit 6e525cc5d9
2 changed files with 4 additions and 1 deletions

View file

@ -63,6 +63,9 @@ int wcsfilecmp(const wchar_t *a, const wchar_t *b) {
wint_t al = towupper(*a);
wint_t bl = towupper(*b);
if (al == L'-') al += 48;
if (bl == L'-') bl += 48;
if (al < bl) {
retval = -1;
break;

View file

@ -6,9 +6,9 @@ test/data/ Directory
# __fish_complete_directories test/data/
test/data/abc/ Directory
test/data/abcd/ Directory
test/data/fish/ Directory
test/data/fish-symlink/ Directory
test/data/fish-symlink2/ Directory
test/data/fish/ Directory
test/data/xy/ Directory
test/data/xyz/ Directory
# __fish_complete_directories test/data/abc