2024-05-09 00:15:42 +02:00
|
|
|
use crate::commands::{Command, IntoCommand};
|
|
|
|
|
2024-05-02 23:47:47 +02:00
|
|
|
#[derive(Debug)]
|
|
|
|
pub enum Msg {
|
|
|
|
MoveRight,
|
|
|
|
MoveLeft,
|
|
|
|
MoveDown,
|
|
|
|
MoveUp,
|
2024-05-07 23:21:13 +02:00
|
|
|
OpenCreateItemDialog,
|
|
|
|
|
|
|
|
EnterInsertMode,
|
2024-05-09 00:15:42 +02:00
|
|
|
EnterViewMode,
|
2024-05-07 23:21:13 +02:00
|
|
|
EnterCommandMode,
|
2024-05-09 00:15:42 +02:00
|
|
|
|
2024-05-09 12:07:23 +02:00
|
|
|
SubmitCommand { command: String },
|
2024-05-09 00:15:42 +02:00
|
|
|
|
2024-05-07 23:21:13 +02:00
|
|
|
Edit(EditMsg),
|
|
|
|
}
|
|
|
|
|
2024-05-09 00:15:42 +02:00
|
|
|
impl IntoCommand for Msg {
|
|
|
|
fn into_command(self) -> crate::commands::Command {
|
|
|
|
Command::new(|| Some(self))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-05-07 23:21:13 +02:00
|
|
|
#[derive(Debug)]
|
|
|
|
pub enum EditMsg {
|
|
|
|
Delete,
|
|
|
|
InsertNewLine,
|
|
|
|
InsertTab,
|
|
|
|
DeleteNext,
|
|
|
|
InsertChar(char),
|
|
|
|
MoveLeft,
|
|
|
|
MoveRight,
|
2024-05-02 23:47:47 +02:00
|
|
|
}
|