From 319a0025e31ec5727a77106852271ea3e5e35f5b Mon Sep 17 00:00:00 2001 From: CedricMeu Date: Fri, 21 Jun 2024 10:11:06 +0200 Subject: [PATCH] Small cleanup --- helix-term/src/ui/editor.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index a16b96acd..1d43fbcda 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -669,7 +669,7 @@ impl EditorView { let max_displacement = (full_width - viewport.width as i32).max(0); // This part clamps the scrolling of the bufferline to the right of the viewport. - let displacement = right_of_center.min(max_displacement).max(0); + let displacement = right_of_center.clamp(0, max_displacement); // If there's any displacement, there's underflow of the bufferline. let mark_underflow = displacement > 0; @@ -678,7 +678,7 @@ impl EditorView { let mark_overflow = displacement < max_displacement; for tab in buffertabs.iter_mut() { - tab.x = tab.x.saturating_sub(displacement.abs()); + tab.x = tab.x.saturating_sub(displacement); } // Itterate over buffertabs, skip or slice them if left off screen, stop if right of screen.