Skip to content

Commit

Permalink
ui: Only render menu scrollbar if it doesn't fit
Browse files Browse the repository at this point in the history
  • Loading branch information
archseer committed Jan 31, 2022
1 parent 094a0aa commit f10a06f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions helix-term/src/ui/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
}
Expand Down

0 comments on commit f10a06f

Please sign in to comment.