diff options
author | bptato <nincsnevem662@gmail.com> | 2024-02-05 19:20:16 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-02-05 19:20:16 +0100 |
commit | d8156669faa76e199bd2a0576163ae58f8ae7185 (patch) | |
tree | 7cfbdf03ae197b0a3179e89c3a1f469a2703b3d1 /src/js | |
parent | f127f93f92f0d82ef10f9aed9d9e238e134620ee (diff) | |
download | chawan-d8156669faa76e199bd2a0576163ae58f8ae7185.tar.gz |
regex: fix 8-bit narrow strings in JS
The previous approach to add UTF-8 support to libregexp was broken. This time, we use a separate flag (cbuf_len == 3) to indicate UTF-8 input.
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 cbf24134..fdc9e8e0 100644 --- a/src/js/regex.nim +++ b/src/js/regex.nim @@ -138,7 +138,7 @@ proc exec*(regex: Regex, str: string, start = 0, length = -1, nocaps = false): R var start = start while true: let ret = lre_exec(cast[ptr ptr uint8](capture), bytecode, - cast[ptr uint8](cstr), cint(start), cint(length), cint(0), dummyContext) + cast[ptr uint8](cstr), cint(start), cint(length), cint(3), dummyContext) if ret != 1: #TODO error handling? (-1) break result.success = true |