From 6ad0a07abf3dc8fcd885af9dd5ce4ddcd453c71d Mon Sep 17 00:00:00 2001 From: Andrzej Date: Tue, 1 May 2012 13:24:27 +0900 Subject: [PATCH] Swapped 'a-z' and 'A-Z' ranges to match strcoll behavior. See also: http://sourceware.org/bugzilla/show_bug.cgi?id=13063 --- thunar/thunar-file.c | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c index 2b4d9a5..99e580d 100644 --- a/thunar/thunar-file.c +++ b/thunar/thunar-file.c @@ -3479,7 +3479,17 @@ thunar_file_compare_by_name (const ThunarFile *file_a, if (G_UNLIKELY (!case_sensitive)) return (g_unichar_tolower (ac) > g_unichar_tolower (bc)) ? 1 : -1; else - return (ac > bc) ? 1 : -1; + { + gunichar ac2 = ac; + gunichar bc2 = bc; + + /* make 'a' < 'A' by swapping [a-z] and [A-Z] ranges */ + if (ac >= 'a' && ac <= 'z') ac2 = ac + 'A' - 'a'; + if (ac >= 'A' && ac <= 'Z') ac2 = ac + 'a' - 'A'; + if (bc >= 'a' && bc <= 'z') bc2 = bc + 'A' - 'a'; + if (bc >= 'A' && bc <= 'Z') bc2 = bc + 'a' - 'A'; + return (ac2 > bc2) ? 1 : -1; + } } -- 1.7.5.4