From a21d96e7293e32c0d20e8548a65fdd31f92b642d Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Wed, 3 Mar 2021 17:28:50 +0900 Subject: ui: Scrollable popup menu, with scrollbar indicator. --- helix-term/src/ui/popup.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'helix-term/src/ui/popup.rs') diff --git a/helix-term/src/ui/popup.rs b/helix-term/src/ui/popup.rs index e0f7a5c0..7260a997 100644 --- a/helix-term/src/ui/popup.rs +++ b/helix-term/src/ui/popup.rs @@ -39,6 +39,10 @@ impl Component for Popup { fn handle_event(&mut self, event: Event, cx: &mut Context) -> EventResult { let key = match event { Event::Key(event) => event, + Event::Resize(width, height) => { + // TODO: calculate inner area, call component's handle_event with that area + return EventResult::Ignored; + } _ => return EventResult::Ignored, }; @@ -63,6 +67,7 @@ impl Component for Popup { // for some events, we want to process them but send ignore, specifically all input except // tab/enter/ctrl-k or whatever will confirm the selection/ ctrl-n/ctrl-p for scroll. } + fn render(&self, viewport: Rect, surface: &mut Surface, cx: &mut Context) { use tui::text::Text; use tui::widgets::{Paragraph, Widget, Wrap}; -- cgit v1.2.3-70-g09d2