about summary refs log tree commit diff stats
path: root/src/js
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2022-07-25 18:42:24 +0200
committerbptato <nincsnevem662@gmail.com>2022-07-25 18:42:24 +0200
commit7469a7428807d2ffff0000d54d12e209a189d973 (patch)
treebb36c12400e475d7249404c422dbbac7ff8b84a7 /src/js
parentfce9adc58cc762d6f70c1d34ac97efddd171edc7 (diff)
downloadchawan-7469a7428807d2ffff0000d54d12e209a189d973.tar.gz
Incremental search fixes
Diffstat (limited to 'src/js')
-rw-r--r--src/js/regex.nim4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/js/regex.nim b/src/js/regex.nim
index 75ff7535..dcaf1729 100644
--- a/src/js/regex.nim
+++ b/src/js/regex.nim
@@ -127,12 +127,12 @@ proc exec*(regex: Regex, str: string, start = 0): RegexResult =
         var e8 = 0
         var i = 0
         var r: Rune
-        while i < s:
+        while i < s and i < ustr.len:
           fastRuneAt(ustr, i, r)
           let si = r.size()
           s8 += si
           e8 += si
-        while i < e:
+        while i < e and i < ustr.len:
           fastRuneAt(ustr, i, r)
           e8 += r.size()
         result.captures.add((s8, e8))