adjusted explorer to new helix code

imgbot
Roland Singer 2 years ago
parent 8f43b1f6e9
commit eec845cc34

@ -569,7 +569,7 @@ impl Explorer {
} }
key!(Esc) | ctrl!('c') => self.tree.restore_recycle(), key!(Esc) | ctrl!('c') => self.tree.restore_recycle(),
_ => { _ => {
if let EventResult::Consumed(_) = prompt.handle_event(Event::Key(event), cx) { if let EventResult::Consumed(_) = prompt.handle_event(&Event::Key(event), cx) {
self.tree.filter(prompt.line(), cx, &mut self.state); self.tree.filter(prompt.line(), cx, &mut self.state);
} }
self.prompt = Some((action, prompt)); self.prompt = Some((action, prompt));
@ -616,7 +616,7 @@ impl Explorer {
} }
key!(Esc) | ctrl!('c') => self.tree.restore_view(), key!(Esc) | ctrl!('c') => self.tree.restore_view(),
_ => { _ => {
if let EventResult::Consumed(_) = prompt.handle_event(Event::Key(event), cx) { if let EventResult::Consumed(_) = prompt.handle_event(&Event::Key(event), cx) {
if search_next { if search_next {
self.tree.search_next(cx, prompt.line(), &mut self.state); self.tree.search_next(cx, prompt.line(), &mut self.state);
} else { } else {
@ -672,7 +672,7 @@ impl Explorer {
} }
(_, key!(Esc) | ctrl!('c')) => {} (_, key!(Esc) | ctrl!('c')) => {}
_ => { _ => {
prompt.handle_event(Event::Key(event), cx); prompt.handle_event(&Event::Key(event), cx);
self.prompt = Some((action, prompt)); self.prompt = Some((action, prompt));
} }
} }
@ -714,9 +714,9 @@ impl Explorer {
impl Component for Explorer { impl Component for Explorer {
/// Process input events, return true if handled. /// Process input events, return true if handled.
fn handle_event(&mut self, event: Event, cx: &mut Context) -> EventResult { fn handle_event(&mut self, event: &Event, cx: &mut Context) -> EventResult {
let key_event = match event { let key_event = match event {
Event::Key(event) => event, Event::Key(event) => *event,
Event::Resize(..) => return EventResult::Consumed(None), Event::Resize(..) => return EventResult::Consumed(None),
_ => return EventResult::Ignored(None), _ => return EventResult::Ignored(None),
}; };

Loading…
Cancel
Save