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.
Этот коммит содержится в:
родитель
b122d3b8e5
Коммит
bbc7c59563
12
src/files.c
12
src/files.c
@ -2354,11 +2354,13 @@ int diralphasort(const void *va, const void *vb)
|
||||
if (!aisdir && bisdir)
|
||||
return 1;
|
||||
|
||||
/* Standard function brain damage: We should be sorting
|
||||
* alphabetically and case-insensitively according to the current
|
||||
* locale, but there's no standard strcasecoll() function, so we
|
||||
* have to use multibyte strcasecmp() instead. */
|
||||
return mbstrcasecmp(a, b);
|
||||
int difference = mbstrcasecmp(a, b);
|
||||
|
||||
/* If two names are equivalent when ignoring case, compare them bytewise. */
|
||||
if (difference == 0)
|
||||
return strcmp(a, b);
|
||||
else
|
||||
return difference;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user