Skip to main content

render_diff

Function render_diff 

Source
pub fn render_diff(diff_text: &str, width: usize) -> Vec<String>
Expand description

Render a display-diff string into styled terminal lines.

width is the available column count; long diff lines are clipped with … rather than wrapped (a wrapped diff is unreadable).

Layout: a fixed 4-col gutter SIGN NUM│ where SIGN is +/-/ , NUM is the right-aligned line number, and │ is a thin themed rule. The content body follows after the gutter. This lines every diff row up on a shared left edge (the old +123 content format let the content column drift with line-number width) and gives +/- a consistent glyph column.