From f10a06f4def8af15516a4fe4ca35863b9aae3443 Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Mon, 31 Jan 2022 13:46:25 +0900 Subject: ui: Only render menu scrollbar if it doesn't fit --- helix-term/src/ui/menu.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'helix-term/src/ui') diff --git a/helix-term/src/ui/menu.rs b/helix-term/src/ui/menu.rs index e127e09b..f57acd8e 100644 --- a/helix-term/src/ui/menu.rs +++ b/helix-term/src/ui/menu.rs @@ -304,12 +304,14 @@ impl Component for Menu { }, ); + let fits = len <= win_height; + for (i, _) in (scroll..(scroll + win_height).min(len)).enumerate() { let is_marked = i >= scroll_line && i < scroll_line + scroll_height; - if is_marked { + if !fits && is_marked { let cell = &mut surface[(area.x + area.width - 2, area.y + i as u16)]; - cell.set_symbol("▐ "); + cell.set_symbol("▐"); // cell.set_style(selected); // cell.set_style(if is_marked { selected } else { style }); } -- cgit v1.2.3-70-g09d2