Fix 'do_casify_natnum' for events with all flags set

* src/casefiddle.c (do_casify_natnum): Extend range a little, to cover
character events with all modifier flags set.
* test/src/casefiddle-tests.el (casefiddle-allflags): New test.
This commit is contained in:
Pip Cet 2026-05-24 10:11:33 +00:00
parent c146e3643c
commit 94dbab2fe4
2 changed files with 10 additions and 1 deletions

View file

@ -253,7 +253,7 @@ do_casify_natnum (struct casing_context *ctx, Lisp_Object obj)
/* If the character has higher bits set above the flags, return it unchanged.
It is not a real character. */
if (! (0 <= ch && ch <= flagbits))
if (! (0 <= ch && ch <= flagbits + MAX_CHAR))
return obj;
int flags = ch & flagbits;

View file

@ -306,4 +306,13 @@
(casefiddle-tests--check-syms "aa_bb cc_dd" "Aa_Bb Cc_Dd" "Aa_bb Cc_dd")
(casefiddle-tests--check-syms "Aa_Bb Cc_Dd" "Aa_Bb Cc_Dd" "Aa_Bb Cc_Dd"))
(ert-deftest casefiddle-allflags ()
"Check that all-flags events are properly handled by `upcase'."
;; U+00FF LATIN SMALL LETTER Y WITH DIAERESIS
;; U+0178 LATIN CAPITAL LETTER Y WITH DIAERESIS
(should (= (upcase ?\xff)
?\x178))
(should (= (upcase ?\A-\C-\H-\S-\s-\M-\xff)
?\A-\C-\H-\S-\s-\M-\x178)))
;;; casefiddle-tests.el ends here