aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui/menu.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term/src/ui/menu.rs')
-rw-r--r--helix-term/src/ui/menu.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/helix-term/src/ui/menu.rs b/helix-term/src/ui/menu.rs
index 4b1155e3..75769b90 100644
--- a/helix-term/src/ui/menu.rs
+++ b/helix-term/src/ui/menu.rs
@@ -206,6 +206,14 @@ impl<T: Item> Menu<T> {
})
}
+ pub fn selection_mut(&mut self) -> Option<&mut T> {
+ self.cursor.and_then(|cursor| {
+ self.matches
+ .get(cursor)
+ .map(|(index, _score)| &mut self.options[*index])
+ })
+ }
+
pub fn is_empty(&self) -> bool {
self.matches.is_empty()
}