aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui/menu.rs
diff options
context:
space:
mode:
authorBlaž Hrastnik2022-01-31 04:42:32 +0000
committerBlaž Hrastnik2022-01-31 07:04:58 +0000
commit094a0aa3f9877e3b1049f262e65c8efea2b7b73e (patch)
treef1fc1ec2d3f9d2d3529d242133ffe096ba79a5ce /helix-term/src/ui/menu.rs
parentf7f55143a1c8f8f643c4ca59d8c4beb9612ef0bb (diff)
Render code actions as a menu, allow adding padding to popup
Diffstat (limited to 'helix-term/src/ui/menu.rs')
-rw-r--r--helix-term/src/ui/menu.rs15
1 files changed, 11 insertions, 4 deletions
diff --git a/helix-term/src/ui/menu.rs b/helix-term/src/ui/menu.rs
index 9758732c..e127e09b 100644
--- a/helix-term/src/ui/menu.rs
+++ b/helix-term/src/ui/menu.rs
@@ -14,11 +14,18 @@ use helix_view::{graphics::Rect, Editor};
use tui::layout::Constraint;
pub trait Item {
- fn sort_text(&self) -> &str;
- fn filter_text(&self) -> &str;
-
fn label(&self) -> &str;
- fn row(&self) -> Row;
+
+ fn sort_text(&self) -> &str {
+ self.label()
+ }
+ fn filter_text(&self) -> &str {
+ self.label()
+ }
+
+ fn row(&self) -> Row {
+ Row::new(vec![Cell::from(self.label())])
+ }
}
pub struct Menu<T: Item> {