aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui/completion.rs
diff options
context:
space:
mode:
authorath32023-12-19 01:17:12 +0000
committerGitHub2023-12-19 01:17:12 +0000
commit9ba691cd3a8ffb021cb194bd3185317a65c3194a (patch)
tree915ecd2d667ad492317e1a1748c2ba6f57983bcb /helix-term/src/ui/completion.rs
parent06d7dc628e5a5dac9bbfe4802c3b00754a9f7731 (diff)
Support drawing popup frame (#4313)
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
Diffstat (limited to 'helix-term/src/ui/completion.rs')
-rw-r--r--helix-term/src/ui/completion.rs18
1 files changed, 17 insertions, 1 deletions
diff --git a/helix-term/src/ui/completion.rs b/helix-term/src/ui/completion.rs
index e0614722..7c6a0055 100644
--- a/helix-term/src/ui/completion.rs
+++ b/helix-term/src/ui/completion.rs
@@ -2,6 +2,7 @@ use crate::compositor::{Component, Context, Event, EventResult};
use helix_view::{
document::SavePoint,
editor::CompleteAction,
+ graphics::Margin,
theme::{Modifier, Style},
ViewId,
};
@@ -326,9 +327,18 @@ impl Completion {
}
};
});
+
+ let margin = if editor.menu_border() {
+ Margin::vertical(1)
+ } else {
+ Margin::none()
+ };
+
let popup = Popup::new(Self::ID, menu)
.with_scrollbar(false)
- .ignore_escape_key(true);
+ .ignore_escape_key(true)
+ .margin(margin);
+
let mut completion = Self {
popup,
start_offset,
@@ -569,6 +579,12 @@ impl Component for Completion {
// clear area
let background = cx.editor.theme.get("ui.popup");
surface.clear_with(doc_area, background);
+
+ if cx.editor.popup_border() {
+ use tui::widgets::{Block, Borders, Widget};
+ Widget::render(Block::default().borders(Borders::ALL), doc_area, surface);
+ }
+
markdown_doc.render(doc_area, surface, cx);
}
}