Zed_rope.Zip

# Module Zed_rope.Zip

    module Zip: sig .. end

    type t

Type of zippers. A zipper allow to naviguate in a rope in a convenient and efficient manner. Note that a zipper points to a position between two characters, not to a character, so in a rope of length `len` there is `len + 1` positions.

    val make_f : Zed_rope.rope -> int -> t

`make_f rope pos` creates a new zipper pointing to positon `pos` of `rope`.

    val make_b : Zed_rope.rope -> int -> t

`make_f rope pos` creates a new zipper pointing to positon `length rope - pos` of `rope`.

    val offset : t -> int

Returns the position of the zipper in the rope.

    val next : t -> CamomileLibrary.UChar.t * t

`next zipper` returns the code point at the right of the zipper and a zipper to the next position. It raises `Out_of_bounds` if the zipper points to the end of the rope.

    val prev : t -> CamomileLibrary.UChar.t * t

`prev zipper` returns the code point at the left of the zipper and a zipper to the previous position. It raises `Out_of_bounds` if the zipper points to the beginning of the rope.

    val move : int -> t -> t

`move n zip` moves the zipper by `n` characters. If `n` is negative it is moved to the left and if it is positive it is moved to the right. It raises `Out_of_bounds` if the result is outside the bounds of the rope.

    val at_bos : t -> bool

`at_bos zipper` returns `true` iff `zipper` points to the beginning of the rope.

    val at_eos : t -> bool

`at_eos zipper` returns `true` iff `zipper` points to the end of the rope.

    val find_f : (CamomileLibrary.UChar.t -> bool) -> t -> t

`find_f f zip` search forward for a character to satisfy `f`. It returns a zipper pointing to the left of the first character to satisfy `f`, or a zipper pointing to the end of the rope if no such character exists.

    val find_b : (CamomileLibrary.UChar.t -> bool) -> t -> t

`find_b f zip` search backward for a character to satisfy `f`. It returns a zipper pointing to the right of the first character to satisfy `f`, or a zipper pointing to the beginning of the rope if no such character exists.

    val sub : t -> int -> Zed_rope.rope

`sub zipper len` returns the sub-rope of length `len` pointed by `zipper`.

    val slice : t -> t -> Zed_rope.rope

`slice zipper1 zipper2` returns the rope between `zipper1` and `zipper2`. If `zipper1 > zipper2` then this is the same as `slice zipper2 zipper1`.

The result is unspecified if the two zippers do not points to the same rope.