summaryrefslogtreecommitdiff
path: root/enc/unicode.c
diff options
context:
space:
mode:
authorduerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-22 12:08:30 +0000
committerduerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-22 12:08:30 +0000
commit2f455ceca40dcddb0f92c2918796673187cd8ed4 (patch)
tree6e31d87870fbcc51b37b3fab3d9d20aed504ea74 /enc/unicode.c
parentbf99f859419437c9f5826ada08cd7cdca03c7d7f (diff)
* include/ruby/oniguruma.h: Additional flag for characters that are titlecase.
* enc/unicode/case-folding.rb, casefold.h: Using above flag in data. * enc/unicode.c: Marking capitalized character as unmodified if it is already titlecase. * test/ruby/enc/test_case_mapping.rb: Tests for above functionality. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54229 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enc/unicode.c')
-rw-r--r--enc/unicode.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/enc/unicode.c b/enc/unicode.c
index 796eb94c19..c6df689ef5 100644
--- a/enc/unicode.c
+++ b/enc/unicode.c
@@ -158,6 +158,7 @@ code3_equal(const OnigCodePoint *x, const OnigCodePoint *y)
#define ST ONIGENC_CASE_TITLECASE
#define SU ONIGENC_CASE_UP_SPECIAL
#define SL ONIGENC_CASE_DOWN_SPECIAL
+#define IT ONIGENC_CASE_IS_TITLECASE
#define I(n) OnigSpecialIndexEncode(n)
#define L(n) SpecialsLengthEncode(n)
@@ -169,6 +170,7 @@ code3_equal(const OnigCodePoint *x, const OnigCodePoint *y)
#undef ST
#undef SU
#undef SL
+#undef IT
#undef I
#undef L
@@ -718,8 +720,11 @@ onigenc_unicode_case_map(OnigCaseFoldType* flagP,
OnigCodePoint *SpecialsStart = CaseMappingSpecials + OnigSpecialIndexDecode(folded->n);
if (OnigCaseFoldFlags(folded->n)&ONIGENC_CASE_TITLECASE) {
- if (flags&ONIGENC_CASE_TITLECASE)
+ if (flags&ONIGENC_CASE_TITLECASE) {
+ if (OnigCaseFoldFlags(folded->n)&ONIGENC_CASE_IS_TITLECASE)
+ flags ^= ONIGENC_CASE_MODIFIED;
goto SpecialsCopy;
+ }
else
SpecialsStart += SpecialsLengthExtract(*SpecialsStart);
}