aboutsummaryrefslogtreecommitdiffstats
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
commit9c84c5e5507aaf739029552e61d602a3ea0ee265 (patch)
tree6e31d87870fbcc51b37b3fab3d9d20aed504ea74 /enc/unicode.c
parent116aff7f2e98780382d0b660b5e058bc591d3051 (diff)
downloadruby-9c84c5e5507aaf739029552e61d602a3ea0ee265.tar.gz
* 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);
}