diff --git a/book/src/configuration.md b/book/src/configuration.md index 996c5fb6ada36..29e0f86a57ab3 100644 --- a/book/src/configuration.md +++ b/book/src/configuration.md @@ -56,6 +56,7 @@ on unix operating systems. | `rulers` | List of column positions at which to display the rulers. Can be overridden by language specific `rulers` in `languages.toml` file. | `[]` | | `bufferline` | Renders a line at the top of the editor displaying open buffers. Can be `always`, `never` or `multiple` (only shown if more than one buffer is in use) | `never` | | `color-modes` | Whether to color the mode indicator with different colors depending on the mode itself | `false` | +| `popup-border` | Draw border around popups | `false` | ### `[editor.statusline]` Section diff --git a/helix-term/src/ui/lsp.rs b/helix-term/src/ui/lsp.rs index 393d24c467bc1..ed9040b94f974 100644 --- a/helix-term/src/ui/lsp.rs +++ b/helix-term/src/ui/lsp.rs @@ -89,7 +89,10 @@ impl Component for SignatureHelp { Some(doc) => Markdown::new(doc.clone(), Arc::clone(&self.config_loader)), }; let sig_doc = sig_doc.parse(Some(&cx.editor.theme)); - let sig_doc_area = area.clip_top(sig_text_area.height + 2); + let mut sig_doc_area = area.clip_top(sig_text_area.height + 2); + if cx.editor.config().popup_border { + sig_doc_area = sig_doc_area.clip_bottom(1); + } let sig_doc_para = Paragraph::new(sig_doc) .wrap(Wrap { trim: false }) .scroll((cx.scroll.unwrap_or_default() as u16, 0)); diff --git a/helix-term/src/ui/popup.rs b/helix-term/src/ui/popup.rs index 3c140da40aef3..b1943e2abdd95 100644 --- a/helix-term/src/ui/popup.rs +++ b/helix-term/src/ui/popup.rs @@ -220,14 +220,20 @@ impl Component for Popup { let (rel_x, rel_y) = self.get_rel_position(viewport, cx); // clip to viewport - let area = viewport.intersection(Rect::new(rel_x, rel_y, self.size.0, self.size.1)); + let mut area = viewport.intersection(Rect::new(rel_x, rel_y, self.size.0, self.size.1)); // clear area let background = cx.editor.theme.get("ui.popup"); surface.clear_with(area, background); - let inner = area.inner(&self.margin); - self.contents.render(inner, surface, cx); + if cx.editor.config().popup_border { + use tui::widgets::{Block, Borders, Widget}; + Widget::render(Block::default().borders(Borders::ALL), area, surface); + } else { + area = area.inner(&self.margin); + } + + self.contents.render(area, surface, cx); } fn id(&self) -> Option<&'static str> { diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 60b3880c6e14b..ef2c63649498c 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -170,6 +170,8 @@ pub struct Config { pub indent_guides: IndentGuidesConfig, /// Whether to color modes with different colors. Defaults to `false`. pub color_modes: bool, + /// Draw border around popups. + pub popup_border: bool, } #[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] @@ -605,6 +607,7 @@ impl Default for Config { bufferline: BufferLine::default(), indent_guides: IndentGuidesConfig::default(), color_modes: false, + popup_border: false, } } }