Skip to content

Commit

Permalink
wcsfilecmp: punctuation [\]^_` after A-Z.
Browse files Browse the repository at this point in the history
This tweaks wcsfilecmp such that certain punctuation characters will
come after A-Z.

A big win with `set <TAB>` - the __prefixed fish junk now comes
after the stuff users should care about.
  • Loading branch information
floam committed Mar 16, 2019
1 parent 88d20e2 commit 74a22ff
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ int wcsfilecmp(const wchar_t *a, const wchar_t *b) {
if (retval || *a == 0 || *b == 0) break;
}

wint_t al = towlower(*a);
wint_t bl = towlower(*b);
wint_t al = towupper(*a);

This comment has been minimized.

Copy link
@faho

faho Mar 16, 2019

Member

This might have an effect on turkish systems - "i" uppercases to "İ" there.

wint_t bl = towupper(*b);
if (al < bl) {
retval = -1;
break;
Expand Down
2 changes: 2 additions & 0 deletions tests/__fish_complete_directories.out
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ test/data/ Directory
# __fish_complete_directories test/data/
test/data/abc/ Directory
test/data/abcd/ Directory
test/data/fish-symlink/ Directory
test/data/fish-symlink2/ Directory

This comment has been minimized.

Copy link
@floam

floam Mar 16, 2019

Author Member

For anyone confused: this sorting made it so __fish_complete_directories.in was among the last of the test scripts to run, and there were now new leftover dirs from the realpath tests. It did not actually make new stuff appear in completions.

This comment has been minimized.

Copy link
@faho

faho Mar 16, 2019

Member

Wait, this changes glob ordering too?

Uh... that's a larger change, and backwards-incompatible.

This comment has been minimized.

Copy link
@floam

floam Mar 16, 2019

Author Member

Yes, wildcard expansion also uses this, since 2015, before that it was not case insensitive at all. I think the glob sorting also would have changed slightly when @krader1961 rewrote wcsfilecmp. It probably will change again if we ever improve wcsfilecmp further to better mimic sort -v/ls -lv behavior (at which point, it'd be useful to perhaps expose it to the shell via the unimplemented < and > string comparison operator extensions for test).

test/data/fish/ Directory
test/data/xy/ Directory
test/data/xyz/ Directory
Expand Down

0 comments on commit 74a22ff

Please sign in to comment.