diff options
author | Blaž Hrastnik | 2022-02-20 05:55:16 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2022-02-20 05:55:16 +0000 |
commit | c7b326be047a42f6a58146b0de049d48568e397f (patch) | |
tree | 66bde3b3af36e54ba4e75cf8f4dfed23d1d25140 /helix-term/src/ui | |
parent | 2af04325d83cd0141400951252574666cffdf1af (diff) |
ui: prompt: Render aliases + border on the doc
Diffstat (limited to 'helix-term/src/ui')
-rw-r--r-- | helix-term/src/ui/prompt.rs | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs index 7088d6df..cd8e14ee 100644 --- a/helix-term/src/ui/prompt.rs +++ b/helix-term/src/ui/prompt.rs @@ -5,6 +5,7 @@ use helix_view::input::KeyEvent; use helix_view::keyboard::{KeyCode, KeyModifiers}; use std::{borrow::Cow, ops::RangeFrom}; use tui::buffer::Buffer as Surface; +use tui::widgets::{Block, Borders, Widget}; use helix_core::{ unicode::segmentation::GraphemeCursor, unicode::width::UnicodeWidthStr, Position, @@ -26,7 +27,7 @@ pub struct Prompt { history_pos: Option<usize>, completion_fn: Box<dyn FnMut(&Editor, &str) -> Vec<Completion>>, callback_fn: Box<dyn FnMut(&mut Context, &str, PromptEvent)>, - pub doc_fn: Box<dyn Fn(&str) -> Option<&'static str>>, + pub doc_fn: Box<dyn Fn(&str) -> Option<Cow<str>>>, } #[derive(Clone, Copy, PartialEq)] @@ -406,14 +407,18 @@ impl Prompt { let background = theme.get("ui.help"); surface.clear_with(area, background); - text.render( - area.inner(&Margin { - vertical: padding, - horizontal: padding, - }), - surface, - cx, - ); + let block = Block::default() + // .title(self.title.as_str()) + .borders(Borders::ALL) + .border_style(background); + + let inner = block.inner(area).inner(&Margin { + vertical: 0, + horizontal: 1, + }); + + block.render(area, surface); + text.render(inner, surface, cx); } let line = area.height - 1; |