1
0
mirror of https://github.com/sharkdp/bat synced 2026-07-13 15:23:18 +00:00
Files
sharkdp--bat/tests
weili d28aa4a8b4 Fix capacity-overflow panic in print_snip at --terminal-width 1
`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.
2026-06-16 07:06:29 +00:00
..
2025-08-28 17:30:50 +00:00
2022-06-12 16:38:33 +02:00
2026-04-27 22:16:09 +03:00
2026-01-08 09:42:42 -05:00
2021-06-14 08:36:20 +02:00
2026-01-14 21:13:44 -07:00
2024-01-27 14:44:54 +00:00