summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-07-07 15:23:01 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-07-07 15:23:01 +0000
commitf10c88827e2a63ea306527d00ef0377488806ac1 (patch)
tree7ffdae0143de5f7ef736718ee45408499468590d /string.c
parent6aff4b8eaa7e2b8bc0bb458dd1882d4b1b197a04 (diff)
* 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.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/string.c b/string.c
index 983f3e682a..8c1cf0d831 100644
--- a/string.c
+++ b/string.c
@@ -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;