browser: sort names that differ only in case with uppercase first
This is the opposite of what 'ls' does in a UTF-8 locale, but nano has never followed the collating rules of Unicode (uppercase after lowercase, ignoring punctuation, and so on) -- it would be strange to change that now. Until now, nano left such equivalent names unsorted, in a seemingly random order. This fixes https://savannah.gnu.org/bugs/?59059. Bug existed since before version 2.0.6.master
parent
b122d3b8e5
commit
bbc7c59563
12
src/files.c
12
src/files.c
|
@ -2354,11 +2354,13 @@ int diralphasort(const void *va, const void *vb)
|
||||||
if (!aisdir && bisdir)
|
if (!aisdir && bisdir)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/* Standard function brain damage: We should be sorting
|
int difference = mbstrcasecmp(a, b);
|
||||||
* alphabetically and case-insensitively according to the current
|
|
||||||
* locale, but there's no standard strcasecoll() function, so we
|
/* If two names are equivalent when ignoring case, compare them bytewise. */
|
||||||
* have to use multibyte strcasecmp() instead. */
|
if (difference == 0)
|
||||||
return mbstrcasecmp(a, b);
|
return strcmp(a, b);
|
||||||
|
else
|
||||||
|
return difference;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue