1
0
mirror of https://github.com/sharkdp/bat synced 2026-07-17 16:03:19 +00:00
Files
sharkdp--bat/src
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
..
2026-04-20 14:25:49 +02:00
2023-03-14 21:19:14 +01:00
2026-04-27 22:20:33 +03:00
2022-09-04 14:28:44 +02:00
2026-05-06 10:58:02 +02:00
2026-04-20 14:25:49 +02:00
2025-07-15 16:36:58 -07:00
2024-08-18 10:05:37 +02:00
2023-03-03 13:20:03 +01:00
2026-04-20 14:25:49 +02:00
2026-03-03 05:18:49 +02:00