Skip to main content

Command

Enum Command 

Source
pub enum Command {
Show 33 variants 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),
}
Expand description

An editor command.

Variants§

§

Move(Dir)

Move the caret.

§

MoveLineStart

Move to the start of the caret’s sequence.

§

MoveLineEnd

Move to the end of the caret’s sequence.

§

Tab

Move to the next empty slot.

§

ShiftTab

Move to the previous empty slot.

§

MoveTo(CaretPath)

Place the caret, usually at a Editor::hit_test result.

§

Extend(Dir)

Extend the selection by one step.

§

ExtendTo(CaretPath)

Extend the selection to a caret, promoting across structures.

§

SelectAll

Select the whole formula.

§

Collapse

Collapse the selection, or close the menu.

§

InsertAtom(Symbol)

Insert a symbol atom, replacing the selection.

§

InsertHostBox(u32)

Insert an opaque host box carrying a host minted token, refused above crate::MAX_HOST_TOKEN.

§

InsertText(String)

Insert each character as an atom, spaces are kept only in text slots.

§

InsertFraction(FracStyle)

Insert a fraction, wrapping the selection into the numerator.

§

InsertScript(ScriptSlot)

Attach a script to the item left of the caret, or wrap the selection as the base.

§

InsertBigOp(Symbol)

Insert a big operator with empty limits, replacing the selection.

§

InsertSqrt

Insert a radical, wrapping the selection into the radicand.

§

InsertDelimiters

Insert stretchy delimiters, wrapping the selection into the body.

Fields

§open: char

Opening delimiter.

§close: char

Closing delimiter.

§

InsertAccent(Mark)

Insert an accent, wrapping the selection into its base.

§

InsertUnderOver(UnderOverSpec)

Insert an under or over construct, wrapping the selection into its base.

§

InsertStyled(Variant)

Insert a styled run, wrapping the selection into it.

§

InsertMatrix

Insert a matrix, replacing the selection.

Fields

§env: MatrixEnv

Environment.

§rows: usize

Row count, at least one.

§cols: usize

Column count, at least one.

§

InsertDocument(Document)

Paste a document at the caret, replacing the selection, refused when it fails validation.

§

DeleteBackward

Delete backward, selecting or opening the menu next to a structure first.

§

DeleteForward

Delete forward, selecting or opening the menu next to a structure first.

§

MatrixInsertRow(Side)

Insert a matrix row next to the caret’s row.

§

MatrixDeleteRow

Delete the caret’s matrix row.

§

MatrixInsertCol(Side)

Insert a matrix column next to the caret’s column.

§

MatrixDeleteCol

Delete the caret’s matrix column.

§

Confirm

Commit the highlighted menu row, or collapse when no menu is open.

§

MenuSelect(usize)

Commit a visible menu row by index.

§

ReplaceTyped

When the atoms left of the caret spell typed, delete them and run with.

Fields

§typed: String

Characters to match, compared through Symbol::from_char.

§with: Vec<Command>

Commands to run after deleting the match.

§

CloseDelimiter(char)

Leave the innermost matching delimiters when at their end, else insert the character.

Trait Implementations§

Source§

impl Clone for Command

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Command

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Command

Source§

impl PartialEq for Command

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Command

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.