mirror of
https://github.com/reynir/banawa-chat.git
synced 2024-12-22 10:37:53 +00:00
Rope: Fix negative index
Not 100% sure if this is correct :/
This commit is contained in:
parent
53e54b5b9b
commit
8598f7011f
2
rope.ml
2
rope.ml
|
@ -162,7 +162,7 @@ module Make (S : STRING) (C : CONTROL) = struct
|
|||
if len = 0 then empty else mksub ofs stop t
|
||||
|
||||
let rec safe_iter_range f i n = function
|
||||
| Str (s, ofs, _) -> S.iter_range f s (ofs + i) n
|
||||
| Str (s, ofs, _) -> S.iter_range f s (max 0 (ofs + i)) n
|
||||
| App (t1, t2, _, _) ->
|
||||
let n1 = length t1 in
|
||||
if i + n <= n1 then safe_iter_range f i n t1
|
||||
|
|
Loading…
Reference in a new issue