From fb6d0d8f7b2784de7b34566f87b1294ecd358b28 Mon Sep 17 00:00:00 2001 From: Stephen Broadley Date: Sun, 4 Aug 2024 20:47:00 +0100 Subject: [PATCH] simplified code for 'nullspace' calculation in EditorView render --- helix-term/src/ui/editor.rs | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index f57d9f2eb..4eb25935c 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -94,22 +94,8 @@ impl EditorView { let config = editor.config(); if config.nullspace.enable { - let gutter_width = view.gutter_offset(doc); - let text_width = config.text_width as u16; - - let view_width = text_width + gutter_width; - - if view_width < view.area.width { - let null_width = (area.width - view_width) / 2; - - let null_l = area.with_width(null_width).clip_bottom(1); - let null_r = Rect::new( - area.x + view_width + null_width, - area.y, - area.width - view_width - null_width, - area.height, - ) - .clip_bottom(1); + if inner.width < view.area.width { + let (null_l, _, null_r) = area.clip_bottom(1).split_centre_vertical(inner.width); let null_style = theme .try_get("ui.nullspace")