diff options
author | Blaž Hrastnik | 2022-01-31 04:46:25 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2022-01-31 07:04:58 +0000 |
commit | f10a06f4def8af15516a4fe4ca35863b9aae3443 (patch) | |
tree | f3af37ab8f3615aa539fe45e3b1921295bdd53ad /helix-term/src/ui | |
parent | 094a0aa3f9877e3b1049f262e65c8efea2b7b73e (diff) |
ui: Only render menu scrollbar if it doesn't fit
Diffstat (limited to 'helix-term/src/ui')
-rw-r--r-- | helix-term/src/ui/menu.rs | 6 |
1 files changed, 4 insertions, 2 deletions
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<T: Item + 'static> Component for Menu<T> { }, ); + 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 }); } |