From 6220faeb4e9be16b9dec728e72ea8dff2cfe35ba Mon Sep 17 00:00:00 2001 From: Michal Nazarewicz Date: Wed, 7 Sep 2016 21:00:57 +0200 Subject: casing: don’t assume letters are *either* upper- or lower-case (bug#24603) A compatibility digraph characters, such as Dž, are neither upper- nor lower-case. At the moment however, those are reported as upper-case¹ despite the fact that they change when upper-cased. Stop checking if a character is upper-case before trying to up-case it so that title-case characters are handled correctly. This fixes one of the issues mentioned in bug#24603. ¹ Because they change when converted to lower-case. Notice an asymmetry in that for a character to be considered lower-case it must not be upper-case (plus the usual condition of changing when upper-cased). * src/buffer.h (upcase1): Delete. (upcase): Change to upcase character unconditionally just like downcase does it. This is what upcase1 was. * src/casefiddle.c (casify_object, casify_region): Use upcase instead of upcase1 and don’t check !uppercasep(x) before calling upcase. * src/keyboard.c (read_key_sequence): Don’t check if uppercase(x), just downcase(x) and see if it changed. * test/src/casefiddle-tests.el (casefiddle-tests--characters, casefiddle-tests-casing): Update test cases which are now passing. --- test/src/casefiddle-tests.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test/src') diff --git a/test/src/casefiddle-tests.el b/test/src/casefiddle-tests.el index c752bb09172..152d85de006 100644 --- a/test/src/casefiddle-tests.el +++ b/test/src/casefiddle-tests.el @@ -63,13 +63,13 @@ (?Ł ?Ł ?ł ?Ł) (?ł ?Ł ?ł ?Ł) - ;; FIXME(bug#24603): We should have: + ;; FIXME(bug#24603): Commented ones are what we want. ;;(?DŽ ?DŽ ?dž ?Dž) - ;; but instead we have: (?DŽ ?DŽ ?dž ?DŽ) - ;; FIXME(bug#24603): Those two are broken at the moment: ;;(?Dž ?DŽ ?dž ?Dž) + (?Dž ?DŽ ?dž ?DŽ) ;;(?dž ?DŽ ?dž ?Dž) + (?dž ?DŽ ?dž ?DŽ) (?Σ ?Σ ?σ ?Σ) (?σ ?Σ ?σ ?Σ) @@ -197,7 +197,7 @@ ;;("ΌΣΟΣ" "ΌΣΟΣ" "όσος" "Όσος" "Όσος") ;; And here’s what is actually happening: ("DŽUNGLA" "DŽUNGLA" "džungla" "DŽungla" "DŽUNGLA") - ("Džungla" "DžUNGLA" "džungla" "Džungla" "Džungla") + ("Džungla" "DŽUNGLA" "džungla" "DŽungla" "DŽungla") ("džungla" "DŽUNGLA" "džungla" "DŽungla" "DŽungla") ("define" "DEfiNE" "define" "Define" "Define") ("fish" "fiSH" "fish" "fish" "fish") -- cgit v1.2.1