diff options
author | Steve Bennett <steveb@workware.net.au> | 2019-10-28 07:40:57 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2019-10-28 07:43:21 +1000 |
commit | 27ed764fa513ea55f92ea1e6be500fb22b30007b (patch) | |
tree | e3ae8820f41c03e34accd575614a7002630818e2 /jim-regexp.c | |
parent | 9eba9e87fc3ed257bf82c1bc7e2f77dba1aaf9a5 (diff) | |
download | jimtcl-27ed764fa513ea55f92ea1e6be500fb22b30007b.zip jimtcl-27ed764fa513ea55f92ea1e6be500fb22b30007b.tar.gz jimtcl-27ed764fa513ea55f92ea1e6be500fb22b30007b.tar.bz2 |
regexp: Fix -indices in the utf-8 case
The calculation of the end index was wrong.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'jim-regexp.c')
-rw-r--r-- | jim-regexp.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/jim-regexp.c b/jim-regexp.c index 3134598..b0411f8 100644 --- a/jim-regexp.c +++ b/jim-regexp.c @@ -284,7 +284,7 @@ int Jim_RegexpCmd(Jim_Interp *interp, int argc, Jim_Obj *const *argv) if (opt_indices) { /* rm_so and rm_eo are byte offsets. We need char offsets */ int so = utf8_strlen(source_str, pmatch[j].rm_so); - int eo = utf8_strlen(source_str + pmatch[j].rm_so, pmatch[j].rm_eo); + int eo = utf8_strlen(source_str, pmatch[j].rm_eo); Jim_ListAppendElement(interp, resultObj, Jim_NewIntObj(interp, offset + so)); Jim_ListAppendElement(interp, resultObj, Jim_NewIntObj(interp, offset + eo - 1)); } |