ropes
ropes copied to clipboard
StackOverflowError when creating a view from a snipped rope.
I haven't fully investigated the issue, but I do have a short repro:
> (ropes/view (ropes/snip (ropes/rope [1 2])
1 2)
0 1)
Execution error (StackOverflowError) at ropes.core/rope (core.clj:331).
null
workaround: Checking to see if the view spans the full rope and just returning the rope seems to be a sufficient workaround.
Happy to provide more info that might be helpful.
I'm trying to use ropes to build a text editor and ropes seems to be a great fit so far. Thanks!
It seems like the problem may also occur even when the view doesn't span the full rope. Another repro:
> (-> (ropes/rope [1 2 3 4])
(ropes/snip 3 4)
(ropes/view 1 3))
Execution error (StackOverflowError) at ropes.core/rope (core.clj:331).
null
Another short repro without ropes/view:
> (-> (ropes/rope [1 2 3 4 5])
(ropes/snip 4 5)
(ropes/snip 3 4))
Execution error (StackOverflowError) at ropes.core/rope (core.clj:331).
null
Curiously, the following work:
> (-> (ropes/rope [1 2 3 4 5])
(ropes/snip 4 5)
(ropes/snip 3 ))
;; #rope [ 1 2 3 ]
> (-> (ropes/rope [1 2 3 4 5])
(ropes/snip 4)
(ropes/snip 3))
;; #rope [ 1 2 3 ]