3 Commits
Author SHA1 Message Date
dualfroz dcd4b1c6ad Describe this repository 2026-10-22 21:02:35 +02:00
dualfroz 7f1f320438 fix: prevent side-by-side panic with narrow width or large tab width
When rendering a side-by-side diff, `SourceDimensions::new` could compute
a per-column content width that was not greater than the tab width. That
violates the precondition of `split_and_apply`, which asserts
`max_len > tab_width` so it can always fit at least one expanded tab and
make progress when wrapping. As a result difftastic aborted with a panic
on ordinary input, for example `difft --width 14 a b` or, even at the
default terminal width, `difft --tab-width 100 a b`.

A very small `--width` could also drive the total display width down to
two columns or fewer, underflowing the `display_width - SPACER.len()`
subtraction (previously guarded by an assertion that itself aborted).

Enforce both invariants in `SourceDimensions::new`: keep room for the
column spacer, and ensure each content column is wider than the tab
width. Narrow terminals now degrade gracefully instead of crashing.
2026-09-02 11:06:59 +02:00
upstream 32b79c1a63 Upstream Wilfred/difftastic state of the touched files before 519f6a9c21 2026-09-02 11:06:59 +02:00