From 634b6d455f064116c609e7cfa1b2b45e51f40029 Mon Sep 17 00:00:00 2001 From: Gokul Soumya Date: Tue, 9 Aug 2022 07:01:26 +0530 Subject: Add custom event type replacing crossterm's Event (#3169) Ported over from 61365dfbf3 in the `gui` branch. This will allow adding our own events, most notably an idle timer event (useful for adding debounced input in [dynamic pickers][1] used by interactive global search and workspace symbols). [1]: https://github.com/helix-editor/helix/pull/3110 Co-authored-by: Blaž Hrastnik --- helix-term/src/ui/menu.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'helix-term/src/ui/menu.rs') diff --git a/helix-term/src/ui/menu.rs b/helix-term/src/ui/menu.rs index 6bb64139..ce51ecbc 100644 --- a/helix-term/src/ui/menu.rs +++ b/helix-term/src/ui/menu.rs @@ -1,10 +1,9 @@ use std::{borrow::Cow, path::PathBuf}; use crate::{ - compositor::{Callback, Component, Compositor, Context, EventResult}, + compositor::{Callback, Component, Compositor, Context, Event, EventResult}, ctrl, key, shift, }; -use crossterm::event::Event; use tui::{buffer::Buffer as Surface, text::Spans, widgets::Table}; pub use tui::widgets::{Cell, Row}; @@ -237,7 +236,7 @@ impl Component for Menu { compositor.pop(); })); - match event.into() { + match event { // esc or ctrl-c aborts the completion and closes the menu key!(Esc) | ctrl!('c') => { (self.callback_fn)(cx.editor, self.selection(), MenuEvent::Abort); -- cgit v1.2.3-70-g09d2