shrs_core/readline/
line_events.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//! Events that occur in readline

use crossterm::event::KeyEvent;

use crate::prelude::{HookEvent, HookEventMarker, LineMode};

/// Runs whenever the current mode of the line changes
#[derive(HookEvent)]
pub struct LineModeSwitchEvent {
    pub line_mode: LineMode,
}

// #[derive(HookEvent)]
// pub struct ReadEventStartEvent;

// #[derive(HookEvent)]
// pub struct PreRenderEvent {}

// #[derive(HookEvent)]
// pub struct PostRenderEvent {}

// #[derive(HookEvent)]
// pub struct ReadEventEndEvent;

/// Alternative for keybinding
///
/// It is recommended that keybinding is used instead
/// if the hook is responding to a specific keypress
#[derive(HookEvent)]
pub struct OnKeyEvent {
    key: KeyEvent,
}