ui: Only render menu scrollbar if it doesn't fit

pull/1608/head
Blaž Hrastnik 3 years ago
parent 094a0aa3f9
commit f10a06f4de

@ -304,10 +304,12 @@ impl<T: Item + 'static> Component for Menu<T> {
}, },
); );
let fits = len <= win_height;
for (i, _) in (scroll..(scroll + win_height).min(len)).enumerate() { for (i, _) in (scroll..(scroll + win_height).min(len)).enumerate() {
let is_marked = i >= scroll_line && i < scroll_line + scroll_height; 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)]; 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(selected);

Loading…
Cancel
Save