use crate::{ecs::components::buffer::ViewEntity, vim::KeyToken};
use bevy::prelude::Message;
pub use super::error::VimInputRejectionReason;
#[derive(Clone, Debug, Eq, Message, PartialEq)]
pub enum EditorInputEvent {
Key(KeyInputEvent),
Text(TextInputEvent),
}
impl EditorInputEvent {
#[must_use]
pub const fn is_repeated_key(&self) -> bool {
matches!(self, Self::Key(key) if key.repeated)
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub struct KeyInputEvent {
pub token: KeyToken,
pub repeated: bool,
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct TextInputEvent {
pub text: String,
}
#[derive(Clone, Copy, Debug, Eq, Message, PartialEq)]
pub struct VimInputRejected {
pub target: ViewEntity,
pub reason: VimInputRejectionReason,
}