Module Side_by_side.Line

type t = {
  1. line_number : int option;
  2. contents : ([ `Next | `Prev | `Same ] * Ansi_text.t) list;
}

A line in the previous file will only ever have `Prev and `Same while lines in the next file will only have `Same and `Next.

This means all deletions will be denoted on the left (previous) side and all additions will be denoted on the right (next) side.

line_number is the line-number in the original file.

val sexp_of_t : t -> Sexplib0.Sexp.t
val to_string : t -> string
val styled_string : ?output:Output.t -> style:([ `Next | `Prev | `Same ] -> string -> string) -> t -> string

~style gets applied to each phrase, then phrases are concatenated.

val line_number : t -> int option

Line-number in the original file. Should only be None for an empty line produced when padding to match alignment.

val width : t -> int

The width of the line if it were printed in the terminal.

val wrap : t -> width:int -> t list
val truncate : t -> width:int -> t
val any_non_same : t -> bool