@@ -48,6 +48,8 @@ pub struct Menu<T: Item> {
4848}
4949
5050impl<T: Item> Menu<T> {
51+ const LEFT_PADDING: usize = 1;
52+
5153 // TODO: it's like a slimmed down picker, share code? (picker = menu + prompt with different
5254 // rendering)
5355 pub fn new(
@@ -150,6 +152,7 @@ impl<T: Item> Menu<T> {
150152 len += 1; // +1: reserve some space for scrollbar
151153 }
152154
155+ len += Self::LEFT_PADDING;
153156 let width = len.min(viewport.0 as usize);
154157
155158 self.widths = max_lens
@@ -271,6 +274,7 @@ impl<T: Item + 'static> Component for Menu<T> {
271274 .try_get("ui.menu")
272275 .unwrap_or_else(|| theme.get("ui.text"));
273276 let selected = theme.get("ui.menu.selected");
277+ surface.clear_with(area, style);
274278
275279 let scroll = self.scroll;
276280
@@ -306,7 +310,7 @@ impl<T: Item + 'static> Component for Menu<T> {
306310 use tui::widgets::TableState;
307311
308312 table.render_table(
309− area,
313+ area.clip_left(Self::LEFT_PADDING as u16),
310314 surface,
311315 &mut TableState {
312316 offset: scroll,
@@ -314,6 +318,12 @@ impl<T: Item + 'static> Component for Menu<T> {
314318 },
315319 );
316320
321+ if let Some(cursor) = self.cursor {
322+ let offset_from_top = cursor - scroll;
323+ let cell = &mut surface[(area.x, area.y + offset_from_top as u16)];
324+ cell.set_style(selected);
325+ }
326+
317327 let fits = len <= win_height;
318328
319329 for (i, _) in (scroll..(scroll + win_height).min(len)).enumerate() {