summaryrefslogtreecommitdiff
path: root/src/casefiddle.c
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2021-10-20 09:38:31 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2021-10-20 09:38:31 +0200
commit1fb8a1569dab5a5cb99afad9678b3bebae1733c5 (patch)
treea56c187cca8b24a368af512607dd7fbbd04adb58 /src/casefiddle.c
parent442101433c6459202e325264e3bbf97790f512e6 (diff)
downloademacs-1fb8a1569dab5a5cb99afad9678b3bebae1733c5.tar.gz
emacs-1fb8a1569dab5a5cb99afad9678b3bebae1733c5.tar.bz2
emacs-1fb8a1569dab5a5cb99afad9678b3bebae1733c5.zip
Further fixes for Turkish case changes in unibyte strings
* src/casefiddle.c (struct casing_context): Add new slot to keep track of what the previous operation was. (case_character_impl): Set it. (do_casify_unibyte_string): Use it to handle Turkish correctly.
Diffstat (limited to 'src/casefiddle.c')
-rw-r--r--src/casefiddle.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/casefiddle.c b/src/casefiddle.c
index e41ada868d0..81e9ed153fb 100644
--- a/src/casefiddle.c
+++ b/src/casefiddle.c
@@ -54,6 +54,9 @@ struct casing_context
/* Whether the context is within a word. */
bool inword;
+
+ /* What the last operation was. */
+ bool downcase_last;
};
/* Initialize CTX structure for casing characters. */
@@ -143,10 +146,14 @@ case_character_impl (struct casing_str_buf *buf,
/* 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);
@@ -324,7 +331,7 @@ do_casify_unibyte_string (struct casing_context *ctx, Lisp_Object obj)
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;