From 07b284509dc3f54adfdab23b0b7c6beffb65d0aa Mon Sep 17 00:00:00 2001 From: etienne-k <2804556+etienne-k@users.noreply.github.com> Date: Wed, 22 Jun 2022 16:48:38 +0200 Subject: [PATCH] fix(statusline): avoid an overflow when calculating the maximal center width --- helix-term/src/ui/statusline.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helix-term/src/ui/statusline.rs b/helix-term/src/ui/statusline.rs index b5699ea72..a65f2220e 100644 --- a/helix-term/src/ui/statusline.rs +++ b/helix-term/src/ui/statusline.rs @@ -119,7 +119,7 @@ impl StatusLine { let spacing = 1u16; let edge_width = context.parts.left.width().max(context.parts.right.width()) as u16; - let center_max_width = viewport.width - (2 * edge_width + 2 * spacing); + let center_max_width = viewport.width.saturating_sub(2 * edge_width + 2 * spacing); let center_width = center_max_width.min(context.parts.center.width() as u16); surface.set_spans(