diff options
author | CossonLeo | 2021-08-28 04:54:24 +0000 |
---|---|---|
committer | GitHub | 2021-08-28 04:54:24 +0000 |
commit | d6a9c2c0f6f4af98146b52d1c886a1ca99d15676 (patch) | |
tree | 080bb2d5ff195a2256c060fbab44be5406711dfa | |
parent | f22e0aa2ae4169851b43d2225e6a43ef36442659 (diff) |
Add ui.menu text style (#664)
* add menu text style
* add ui.menu.text ui.info ui.info.text to book
* change ui.menu.text to ui.menu
* fix book's ui.menu
-rw-r--r-- | book/src/themes.md | 3 | ||||
-rw-r--r-- | helix-term/src/ui/menu.rs | 7 |
2 files changed, 8 insertions, 2 deletions
diff --git a/book/src/themes.md b/book/src/themes.md index f17195aa..0a4d58ad 100644 --- a/book/src/themes.md +++ b/book/src/themes.md @@ -91,6 +91,9 @@ Possible keys: | `ui.help` | | | `ui.text` | | | `ui.text.focus` | | +| `ui.info` | | +| `ui.info.text` | | +| `ui.menu` | | | `ui.menu.selected` | | | `ui.selection` | For selections in the editing area | | `ui.selection.primary` | | diff --git a/helix-term/src/ui/menu.rs b/helix-term/src/ui/menu.rs index a56cf19b..24dd3e61 100644 --- a/helix-term/src/ui/menu.rs +++ b/helix-term/src/ui/menu.rs @@ -259,8 +259,11 @@ impl<T: Item + 'static> Component for Menu<T> { // TODO: required size should re-trigger when we filter items so we can draw a smaller menu fn render(&mut self, area: Rect, surface: &mut Surface, cx: &mut Context) { - let style = cx.editor.theme.get("ui.text"); - let selected = cx.editor.theme.get("ui.menu.selected"); + let theme = &cx.editor.theme; + let style = theme + .try_get("ui.menu") + .unwrap_or_else(|| theme.get("ui.text")); + let selected = theme.get("ui.menu.selected"); let scroll = self.scroll; |