diff options
author | bptato <nincsnevem662@gmail.com> | 2023-01-03 18:06:23 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-01-03 18:06:23 +0100 |
commit | 10a4c94977c364086056f62dd704c8b9da7c3c8b (patch) | |
tree | 8c368f1d09271f2e93cb535f90d269892e0dbcde /src/js | |
parent | 69f184a1129a828bda9a00f6830871aa2f628bd6 (diff) | |
download | chawan-10a4c94977c364086056f62dd704c8b9da7c3c8b.tar.gz |
regex: fix setting start in unicode strings
We have to set it to (capture - cstr) >> 1, because libregexp later shifts it left.
Diffstat (limited to 'src/js')
-rw-r--r-- | src/js/regex.nim | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/js/regex.nim b/src/js/regex.nim index eb4fe365..f34f88e1 100644 --- a/src/js/regex.nim +++ b/src/js/regex.nim @@ -191,7 +191,7 @@ proc exec*(regex: Regex, str: string, start = 0, length = -1, nocaps = false): R if captureCount == 0 or nocaps: break let cstrAddress = cast[int](cstr) - start = cast[ptr int](cast[int](capture) + sizeof(ptr uint8))[] - cstrAddress + start = (cast[ptr int](cast[int](capture) + sizeof(ptr uint8))[] - cstrAddress) shr cint(not ascii) var i = 0 while i < captureCount * sizeof(ptr uint8): let s = cast[ptr int](cast[int](capture) + i)[] - cstrAddress |