package inquire

  1. Overview
  2. Docs
An OCaml library to create beautiful interactive CLIs

Install

Dune Dependency

Authors

Maintainers

Sources

inquire-0.2.1.tbz
sha256=0b88d89e24d4cbc0560a7c8d8ec51388990e1b27f24685029997afa52a7c720f
sha512=8b62860a8d15e41528a404a6f1b9968c3d79755607b5ea319af2e3e45516e672a785361d278279910928db4054e1800e87bcee0210ff3eabfb330713b368c827

doc/inquire.zed/Zed_lines/index.html

Module Zed_linesSource

Sets of line positions.

This module implement sets of line positions. They allow to efficiently find the beginning of a line and to convert offset to line and column number.

Sourceexception Out_of_bounds

Exception raised when trying to access a position outside the bounds of a set.

Sourcetype line
Sourcetype t

Type of sets of line positions.

Sourceval length : t -> int

Returns the length of the set, i.e. the number of characters in the set.

Sourceval count : t -> int

Returns the number of newlines in the set.

Sourceval of_rope : Zed_rope.t -> t

of_rope rope returns the set of newline positions in rope.

Sourceval empty : t

The empty set.

Sourceval width : ?tolerant:bool -> t -> int -> int -> (int, int) Result.result

Returns the width of the given string.

Sourceval force_width : t -> int -> int -> int

Returns the width of the given string. If error encounted, returns the width of the legit part

Sourceval line_index : t -> int -> int

line_index set ofs returns the line number of the line containing ofs.

Sourceval line_start : t -> int -> int

line_start set idx returns the offset of the beginning of the idxth line of set .

Sourceval line_stop : t -> int -> int

line_stop set idx returns the offset of the end of the idxth line of set .

Sourceval line_length : t -> int -> int

line_length set idx returns the length of the idxth line of set .

Sourceval append : t -> t -> t

append s1 s2 concatenates two sets of line positions.

Sourceval insert : t -> int -> t -> t

insert set offset set' inserts set at given positon in set'.

Sourceval remove : t -> int -> int -> t

remove set offet length removes length characters at offset in set.

Sourceval replace : t -> int -> int -> t -> t

replace set offset length repl replaces the subset at offset offset and length length by repl in set.

Sourceval get_idx_by_width : t -> int -> int -> int

get_idx_by_width set row column_width return the offset of the char at [row, column_width].

OCaml

Innovation. Community. Security.