Rope.lineStartByIndex

Get the index of the start or end of the line — from index of any character on the same line.

struct Rope
size_t
lineStartByIndex
(
size_t index
)

Examples

auto rope = Rope("Hello, World!\nHello, Fluid!");

assert(rope.lineStartByIndex(5) == 0);
assert(rope.lineEndByIndex(5) == 13);
assert(rope.lineStartByIndex(18) == 14);
assert(rope.lineEndByIndex(18) == rope.length);

Meta