mirror of
https://github.com/sharkdp/bat
synced 2026-07-13 15:23:18 +00:00
d28aa4a8b4
`InteractivePrinter::print_snip` computes the snip separator width as `term_width - panel_count - snip_left_count - title_count`. At `--terminal-width 1` the panel is disabled and `title_count == 2`, so the subtraction underflows `usize` (release has no overflow-checks, so it wraps to ~usize::MAX); `str::repeat` then aborts with "capacity overflow" whenever a snip separator is emitted (two or more disjoint line ranges, or a diff gap) — which the default style does. Use `saturating_sub` for the repeat counts so they clamp to 0 instead of underflowing. Added an integration test.