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/popup.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (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 77ab2462..af8e53c5 100644 --- a/helix-term/src/ui/popup.rs +++ b/helix-term/src/ui/popup.rs @@ -1,9 +1,8 @@ use crate::{ commands::Open, - compositor::{Callback, Component, Context, EventResult}, + compositor::{Callback, Component, Context, Event, EventResult}, ctrl, key, }; -use crossterm::event::Event; use tui::buffer::Buffer as Surface; use helix_core::Position; @@ -149,7 +148,7 @@ impl Component for Popup { _ => return EventResult::Ignored(None), }; - if key!(Esc) == key.into() && self.ignore_escape_key { + if key!(Esc) == key && self.ignore_escape_key { return EventResult::Ignored(None); } @@ -158,7 +157,7 @@ impl Component for Popup { compositor.remove(self.id.as_ref()); }); - match key.into() { + match key { // esc or ctrl-c aborts the completion and closes the menu key!(Esc) | ctrl!('c') => { let _ = self.contents.handle_event(event, cx); -- cgit v1.2.3-70-g09d2