liner/
event.rs

1use crate::Editor;
2use std::io::Write;
3use termion::event::Key;
4
5pub struct Event<'a, 'out: 'a, W: Write + 'a> {
6    pub editor: &'a mut Editor<'out, W>,
7    pub kind: EventKind,
8}
9
10impl<'a, 'out: 'a, W: Write + 'a> Event<'a, 'out, W> {
11    pub fn new(editor: &'a mut Editor<'out, W>, kind: EventKind) -> Self {
12        Event { editor, kind }
13    }
14}
15
16#[derive(Debug)]
17pub enum EventKind {
18    /// Sent before handling a keypress.
19    BeforeKey(Key),
20    /// Sent after handling a keypress.
21    AfterKey(Key),
22    /// Sent in `Editor.complete()`, before processing the completion.
23    BeforeComplete,
24}