mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-22 09:26:19 +04:00
Prompt needs to close on enter.
This commit is contained in:
parent
ca809617b2
commit
f92998a14b
@ -151,6 +151,11 @@ fn handle_event(&mut self, event: Event, cx: &mut Context) -> EventResult {
|
||||
_ => return EventResult::Ignored,
|
||||
};
|
||||
|
||||
let close_fn = EventResult::Consumed(Some(Box::new(|compositor: &mut Compositor| {
|
||||
// remove the layer
|
||||
compositor.pop();
|
||||
})));
|
||||
|
||||
match event {
|
||||
KeyEvent {
|
||||
code: KeyCode::Char(c),
|
||||
@ -159,10 +164,7 @@ fn handle_event(&mut self, event: Event, cx: &mut Context) -> EventResult {
|
||||
KeyEvent {
|
||||
code: KeyCode::Esc, ..
|
||||
} => {
|
||||
return EventResult::Consumed(Some(Box::new(|compositor: &mut Compositor| {
|
||||
// remove the layer
|
||||
compositor.pop();
|
||||
})));
|
||||
return close_fn;
|
||||
}
|
||||
KeyEvent {
|
||||
code: KeyCode::Right,
|
||||
@ -187,7 +189,10 @@ fn handle_event(&mut self, event: Event, cx: &mut Context) -> EventResult {
|
||||
KeyEvent {
|
||||
code: KeyCode::Enter,
|
||||
..
|
||||
} => (self.callback_fn)(cx.editor, &self.line),
|
||||
} => {
|
||||
(self.callback_fn)(cx.editor, &self.line);
|
||||
return close_fn;
|
||||
}
|
||||
KeyEvent {
|
||||
code: KeyCode::Tab, ..
|
||||
} => self.change_completion_selection(),
|
||||
|
Loading…
Reference in New Issue
Block a user