use crate::doc::Document;
use crate::model::{FracStyle, Mark, MatrixEnv, ScriptSlot, Symbol, UnderOverSpec, Variant};
use crate::path::CaretPath;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum Dir {
Left,
Right,
Up,
Down,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum Side {
Before,
After,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum ExitDir {
Left,
Right,
Up,
Down,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum Edge {
Start,
End,
}
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
pub enum HostBoxPolicy {
#[default]
Skip,
Enter,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct HostBoxEntry {
pub token: u32,
pub side: Side,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Command {
Move(Dir),
MoveLineStart,
MoveLineEnd,
Tab,
ShiftTab,
MoveTo(CaretPath),
Extend(Dir),
ExtendTo(CaretPath),
SelectAll,
Collapse,
InsertAtom(Symbol),
InsertHostBox(u32),
InsertText(String),
InsertFraction(FracStyle),
InsertScript(ScriptSlot),
InsertBigOp(Symbol),
InsertSqrt,
InsertDelimiters {
open: char,
close: char,
},
InsertAccent(Mark),
InsertUnderOver(UnderOverSpec),
InsertStyled(Variant),
InsertMatrix {
env: MatrixEnv,
rows: usize,
cols: usize,
},
InsertDocument(Document),
DeleteBackward,
DeleteForward,
MatrixInsertRow(Side),
MatrixDeleteRow,
MatrixInsertCol(Side),
MatrixDeleteCol,
Confirm,
MenuSelect(usize),
ReplaceTyped {
typed: String,
with: Vec<Command>,
},
CloseDelimiter(char),
}
#[must_use]
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
pub struct Outcome {
pub changed: bool,
pub moved: bool,
pub exit: Option<ExitDir>,
pub close: bool,
pub entered_host_box: Option<HostBoxEntry>,
pub revision: u64,
}