/* Whether the context is within a word. */
bool inword;
+
+ /* What the last operation was. */
+ bool downcase_last;
};
/* Initialize CTX structure for casing characters. */
/* Handle simple, one-to-one case. */
if (flag == CASE_DOWN)
- cased = downcase (ch);
+ {
+ cased = downcase (ch);
+ ctx->downcase_last = true;
+ }
else
{
bool cased_is_set = false;
+ ctx->downcase_last = false;
if (!NILP (ctx->titlecase_char_table))
{
prop = CHAR_TABLE_REF (ctx->titlecase_char_table, ch);
character (this can happen in some locales, like the Turkish
"I"), downcase using the ASCII char table. */
if (ASCII_CHAR_P (ch) && !SINGLE_BYTE_CHAR_P (cased))
- cased = ascii_casify_character (ctx->flag == CASE_DOWN, ch);
+ cased = ascii_casify_character (ctx->downcase_last, ch);
SSET (obj, i, make_char_unibyte (cased));
}
return obj;
(with-temp-buffer
(should-error (upcase-region nil nil t)))))
+(ert-deftest casefiddle-turkish ()
+ (skip-unless (member "tr_TR.utf8" (get-locale-names)))
+ (with-locale-environment "tr_TR.utf8"
+ (should (string-equal (downcase "I ı") "ı ı"))
+ (should (string-equal (downcase "İ i") "i̇ i"))
+ (should (string-equal (downcase "I") "i"))
+ (should (string-equal (capitalize "bIte") "Bite"))
+ (should (string-equal (capitalize "bIté") "Bıté"))
+ (should (string-equal (capitalize "indIa") "India"))
+ ;; This does not work -- it produces "Indıa".
+ ;;(should (string-equal (capitalize "indIá") "İndıa"))
+ ))
+
;;; casefiddle-tests.el ends here