@@ -7,11 +7,18 @@ use crate::{
77use helix_core::fuzzy::MATCHER;
88use nucleo::pattern::{Atom, AtomKind, CaseMatching};
99use nucleo::{Config, Utf32Str};
10−use tui::{buffer::Buffer as Surface, widgets::Table};
10+use tui::{
11+ buffer::Buffer as Surface,
12+ widgets::{Block, Borders, Table, Widget},
13+};
1114
1215pub use tui::widgets::{Cell, Row};
1316
14−use helix_view::{editor::SmartTabConfig, graphics::Rect, Editor};
17+use helix_view::{
18+ editor::SmartTabConfig,
19+ graphics::{Margin, Rect},
20+ Editor,
21+};
1522use tui::layout::Constraint;
1623
1724pub trait Item: Sync + Send + 'static {
@@ -322,6 +329,15 @@ impl<T: Item + 'static> Component for Menu<T> {
322329 let selected = theme.get("ui.menu.selected");
323330 surface.clear_with(area, style);
324331
332+ let render_borders = cx.editor.menu_border();
333+
334+ let area = if render_borders {
335+ Widget::render(Block::default().borders(Borders::ALL), area, surface);
336+ area.inner(&Margin::vertical(1))
337+ } else {
338+ area
339+ };
340+
325341 let scroll = self.scroll;
326342
327343 let options: Vec<_> = self
@@ -362,15 +378,19 @@ impl<T: Item + 'static> Component for Menu<T> {
362378 false,
363379 );
364380
365− if let Some(cursor) = self.cursor {
366− let offset_from_top = cursor - scroll;
367− let left = &mut surface[(area.left(), area.y + offset_from_top as u16)];
368− left.set_style(selected);
369− let right = &mut surface[(
370− area.right().saturating_sub(1),
371− area.y + offset_from_top as u16,
372− )];
373− right.set_style(selected);
381+ let render_borders = cx.editor.menu_border();
382+
383+ if !render_borders {
384+ if let Some(cursor) = self.cursor {
385+ let offset_from_top = cursor - scroll;
386+ let left = &mut surface[(area.left(), area.y + offset_from_top as u16)];
387+ left.set_style(selected);
388+ let right = &mut surface[(
389+ area.right().saturating_sub(1),
390+ area.y + offset_from_top as u16,
391+ )];
392+ right.set_style(selected);
393+ }
374394 }
375395
376396 let fits = len <= win_height;
@@ -385,12 +405,13 @@ impl<T: Item + 'static> Component for Menu<T> {
385405 for i in 0..win_height {
386406 cell = &mut surface[(area.right() - 1, area.top() + i as u16)];
387407
388− cell.set_symbol("▐"); // right half block
408+ let half_block = if render_borders { "▌" } else { "▐" };
389409
390410 if scroll_line <= i && i < scroll_line + scroll_height {
391411 // Draw scroll thumb
412+ cell.set_symbol(half_block);
392413 cell.set_fg(scroll_style.fg.unwrap_or(helix_view::theme::Color::Reset));
393− } else {
414+ } else if !render_borders {
394415 // Draw scroll track
395416 cell.set_fg(scroll_style.bg.unwrap_or(helix_view::theme::Color::Reset));
396417 }