Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-term/src/ui/overlay.rs')
| -rw-r--r-- | helix-term/src/ui/overlay.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/helix-term/src/ui/overlay.rs b/helix-term/src/ui/overlay.rs index ff184d40..9f522e35 100644 --- a/helix-term/src/ui/overlay.rs +++ b/helix-term/src/ui/overlay.rs @@ -1,3 +1,4 @@ +use crossterm::event::Event; use helix_core::Position; use helix_view::{ graphics::{CursorKind, Rect}, @@ -5,7 +6,7 @@ use helix_view::{ }; use tui::buffer::Buffer; -use crate::compositor::{Component, Context, Event, EventResult}; +use crate::compositor::{Component, Context, EventResult}; /// Contains a component placed in the center of the parent component pub struct Overlay<T> { @@ -16,7 +17,7 @@ pub struct Overlay<T> { } /// Surrounds the component with a margin of 5% on each side, and an additional 2 rows at the bottom -pub fn overlaid<T>(content: T) -> Overlay<T> { +pub fn overlayed<T>(content: T) -> Overlay<T> { Overlay { content, calc_child_size: Box::new(|rect: Rect| clip_rect_relative(rect.clip_bottom(2), 90, 90)), @@ -61,7 +62,7 @@ impl<T: Component + 'static> Component for Overlay<T> { Some((width, height)) } - fn handle_event(&mut self, event: &Event, ctx: &mut Context) -> EventResult { + fn handle_event(&mut self, event: Event, ctx: &mut Context) -> EventResult { self.content.handle_event(event, ctx) } @@ -69,8 +70,4 @@ impl<T: Component + 'static> Component for Overlay<T> { let dimensions = (self.calc_child_size)(area); self.content.cursor(dimensions, ctx) } - - fn id(&self) -> Option<&'static str> { - self.content.id() - } } |