diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-07-07 15:23:01 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-07-07 15:23:01 +0000 |
commit | f10c88827e2a63ea306527d00ef0377488806ac1 (patch) | |
tree | 7ffdae0143de5f7ef736718ee45408499468590d /string.c | |
parent | 6aff4b8eaa7e2b8bc0bb458dd1882d4b1b197a04 (diff) | |
download | ruby-f10c88827e2a63ea306527d00ef0377488806ac1.tar.gz |
* string.c (rb_str_succ): limit carrying in an alphanumeric region if
exists. [ruby-dev:35094]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17945 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -2535,13 +2535,16 @@ rb_str_succ(VALUE orig) enum neighbor_char neighbor; if ((l = rb_enc_precise_mbclen(s, e, enc)) <= 0) continue; neighbor = enc_succ_alnum_char(s, l, enc, carry); - if (neighbor == NEIGHBOR_NOT_CHAR) - continue; - if (neighbor == NEIGHBOR_FOUND) + if (neighbor == NEIGHBOR_NOT_CHAR) { + if (c == -1) continue; + s++; + } + else if (neighbor == NEIGHBOR_FOUND) return str; c = 1; carry_pos = s - sbeg; carry_len = l; + if (neighbor == NEIGHBOR_NOT_CHAR) break; } if (c == -1) { /* str contains no alnum */ s = e; |