package cascade
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=c11bbdc7ab0eee8c03cd162e3e7fd1cb20de62beb13342b3b150a89264ee0056
sha512=43fd97a55c3b1dc4db5c87aa1a5a047d902e902ab2064af3a7c5bf945ebc333f8cd90ecca8013c17be5b950498eace8e0094ee4319eba408285e2bec8d7cdf7b
doc/cascade.diff/Cascade_diff/String_diff/index.html
Module Cascade_diff.String_diffSource
String difference analysis and formatting.
default_max_width is the default maximum width for formatted output (60 characters).
type config = {max_width : int;(*Maximum display width.
*)short_threshold : int;(*Threshold below which strings are shown inline.
*)show_caret : bool;(*Whether to display position indicators.
*)indent : int;(*Left margin for position indicators.
*)
}Configuration for formatting.
type t = {position : int;(*Character position of first difference.
*)line_expected : int;(*Line number in expected string.
*)column_expected : int;(*Column in expected string.
*)line_actual : int;(*Line number in actual string.
*)column_actual : int;(*Column in actual string.
*)context_before : (string * string) list;(*Lines before difference.
*)diff_lines : string * string;(*Lines containing the difference.
*)context_after : (string * string) list;(*Lines after difference.
*)
}The type for string differences with context.
diff ?context_size ~expected ~actual analyzes the difference between two strings. Returns None if strings are equal, otherwise returns detailed difference information with surrounding context lines. Default context_size is 3.
val pp :
?config:config ->
?expected_label:string ->
?actual_label:string ->
Buffer.t ->
t ->
unitpp ?config ?expected_label ?actual_label buf t pretty-prints a string diff in unified diff format with adaptive line formatting. Default labels are "Expected" and "Actual".
Utilities
first_diff_pos s1 s2 is the position of the first differing character, or None if the strings are equal.
truncate_middle max_len s truncates s to at most max_len characters, preserving both the beginning and end with ellipsis in the middle if truncation occurs.