@@ -7,11 +7,18 @@ use crate::{
7use helix_core::fuzzy::MATCHER;
7use helix_core::fuzzy::MATCHER;
8use nucleo::pattern::{Atom, AtomKind, CaseMatching};
8use nucleo::pattern::{Atom, AtomKind, CaseMatching};
9use nucleo::{Config, Utf32Str};
9use nucleo::{Config, Utf32Str};
10−use tui::{buffer::Buffer as Surface, widgets::Table};
11+ buffer::Buffer as Surface,
12+ widgets::{Block, Borders, Table, Widget},
12pub use tui::widgets::{Cell, Row};
15pub use tui::widgets::{Cell, Row};
14−use helix_view::{editor::SmartTabConfig, graphics::Rect, Editor};
18+ editor::SmartTabConfig,
19+ graphics::{Margin, Rect},
15use tui::layout::Constraint;
22use tui::layout::Constraint;
17pub trait Item: Sync + Send + 'static {
24pub trait Item: Sync + Send + 'static {
@@ -322,6 +329,15 @@ impl<T: Item + 'static> Component for Menu<T> {
322 let selected = theme.get("ui.menu.selected");
329 let selected = theme.get("ui.menu.selected");
323 surface.clear_with(area, style);
330 surface.clear_with(area, style);
332+ let render_borders = cx.editor.menu_border();
334+ let area = if render_borders {
335+ Widget::render(Block::default().borders(Borders::ALL), area, surface);
336+ area.inner(&Margin::vertical(1))
325 let scroll = self.scroll;
341 let scroll = self.scroll;
327 let options: Vec<_> = self
343 let options: Vec<_> = self
@@ -362,15 +378,19 @@ impl<T: Item + 'static> Component for Menu<T> {
381+ let render_borders = cx.editor.menu_border();
383+ if !render_borders {
365− if let Some(cursor) = self.cursor {
384+ if let Some(cursor) = self.cursor {
366− let offset_from_top = cursor - scroll;
385+ let offset_from_top = cursor - scroll;
367− let left = &mut surface[(area.left(), area.y + offset_from_top as u16)];
386+ let left = &mut surface[(area.left(), area.y + offset_from_top as u16)];
368− left.set_style(selected);
387+ left.set_style(selected);
369− let right = &mut surface[(
388+ let right = &mut surface[(
370− area.right().saturating_sub(1),
389+ area.right().saturating_sub(1),
371− area.y + offset_from_top as u16,
390+ area.y + offset_from_top as u16,
373− right.set_style(selected);
392+ right.set_style(selected);
376 let fits = len <= win_height;
396 let fits = len <= win_height;
@@ -385,12 +405,13 @@ impl<T: Item + 'static> Component for Menu<T> {
385 for i in 0..win_height {
405 for i in 0..win_height {
386 cell = &mut surface[(area.right() - 1, area.top() + i as u16)];
406 cell = &mut surface[(area.right() - 1, area.top() + i as u16)];
388− cell.set_symbol("▐"); // right half block
408+ let half_block = if render_borders { "▌" } else { "▐" };
390 if scroll_line <= i && i < scroll_line + scroll_height {
410 if scroll_line <= i && i < scroll_line + scroll_height {
391 // Draw scroll thumb
411 // Draw scroll thumb
412+ cell.set_symbol(half_block);
392 cell.set_fg(scroll_style.fg.unwrap_or(helix_view::theme::Color::Reset));
413 cell.set_fg(scroll_style.fg.unwrap_or(helix_view::theme::Color::Reset));
393− } else {
414+ } else if !render_borders {
394 // Draw scroll track
415 // Draw scroll track
395 cell.set_fg(scroll_style.bg.unwrap_or(helix_view::theme::Color::Reset));
416 cell.set_fg(scroll_style.bg.unwrap_or(helix_view::theme::Color::Reset));