pub struct Tree { /* private fields */ }Expand description
The editable math tree.
Implementations§
Source§impl Tree
impl Tree
Sourcepub fn insert_fragment(&mut self, at: Cursor, frag: &DocFragment) -> Cursor
pub fn insert_fragment(&mut self, at: Cursor, frag: &DocFragment) -> Cursor
Splice a clipboard fragment into at.seq starting at at.index.
Source§impl Tree
impl Tree
Sourcepub fn export_latex(&self) -> (String, SpanMap)
pub fn export_latex(&self) -> (String, SpanMap)
Exports the whole document to rendering LaTeX and records spans for placeholder matching.
Sourcepub fn export_display(&self) -> String
pub fn export_display(&self) -> String
Exports the whole document to clean display and copy LaTeX.
Sourcepub fn selection_latex(&self, sel: Selection) -> String
pub fn selection_latex(&self, sel: Selection) -> String
Exports a selection’s content to clean LaTeX for the host clipboard.
Source§impl Tree
impl Tree
Sourcepub fn seq_parent(&self, id: SeqId) -> Option<NodeId>
pub fn seq_parent(&self, id: SeqId) -> Option<NodeId>
The node that owns this sequence as a slot, or None for the root.
Sourcepub fn index_in_parent(&self, node: NodeId) -> Option<(SeqId, usize)>
pub fn index_in_parent(&self, node: NodeId) -> Option<(SeqId, usize)>
The sequence and index where this node currently lives.
Sourcepub fn child_seqs(&self, node: NodeId) -> Vec<SeqId>
pub fn child_seqs(&self, node: NodeId) -> Vec<SeqId>
All present slot sequences of a node in canonical navigation and ownership order.
Source§impl Tree
impl Tree
Sourcepub fn insert_atom(&mut self, at: Cursor, sym: Symbol) -> Cursor
pub fn insert_atom(&mut self, at: Cursor, sym: Symbol) -> Cursor
Inserts an atom and returns the cursor after it.
Sourcepub fn insert_fraction(
&mut self,
at: Cursor,
style: FracStyle,
sel: Option<Selection>,
) -> Cursor
pub fn insert_fraction( &mut self, at: Cursor, style: FracStyle, sel: Option<Selection>, ) -> Cursor
Inserts a fraction and returns a cursor in the numerator or denominator.
Sourcepub fn insert_sqrt(&mut self, at: Cursor, sel: Option<Selection>) -> Cursor
pub fn insert_sqrt(&mut self, at: Cursor, sel: Option<Selection>) -> Cursor
Inserts a radical and returns a cursor in the radicand.
Sourcepub fn insert_delimiters(
&mut self,
at: Cursor,
open: char,
close: char,
sel: Option<Selection>,
) -> Cursor
pub fn insert_delimiters( &mut self, at: Cursor, open: char, close: char, sel: Option<Selection>, ) -> Cursor
Inserts delimiters and returns a cursor in their body.
Sourcepub fn insert_accent(
&mut self,
at: Cursor,
mark: Mark,
sel: Option<Selection>,
) -> Cursor
pub fn insert_accent( &mut self, at: Cursor, mark: Mark, sel: Option<Selection>, ) -> Cursor
Inserts an accent and returns a cursor in its base.
Sourcepub fn insert_styled(
&mut self,
at: Cursor,
variant: Variant,
sel: Option<Selection>,
) -> Cursor
pub fn insert_styled( &mut self, at: Cursor, variant: Variant, sel: Option<Selection>, ) -> Cursor
Inserts a styled wrapper and returns a cursor in its content.
Sourcepub fn insert_under_over(
&mut self,
at: Cursor,
spec: UnderOverSpec,
sel: Option<Selection>,
) -> Cursor
pub fn insert_under_over( &mut self, at: Cursor, spec: UnderOverSpec, sel: Option<Selection>, ) -> Cursor
Inserts an under or over structure and returns a cursor in its base.
Sourcepub fn insert_matrix(
&mut self,
at: Cursor,
env: MatrixEnv,
rows: usize,
cols: usize,
) -> Cursor
pub fn insert_matrix( &mut self, at: Cursor, env: MatrixEnv, rows: usize, cols: usize, ) -> Cursor
Inserts a matrix and returns a cursor in the first cell.
Sourcepub fn insert_big_op(&mut self, at: Cursor, op: Symbol) -> Cursor
pub fn insert_big_op(&mut self, at: Cursor, op: Symbol) -> Cursor
Inserts a big operator with empty limits and returns a cursor after it.
Sourcepub fn bigop_limit_target(
&self,
at: Cursor,
which: ScriptSlot,
) -> Option<Cursor>
pub fn bigop_limit_target( &self, at: Cursor, which: ScriptSlot, ) -> Option<Cursor>
Returns the BigOp limit targeted by _ or ^ when the cursor is after the operator.
Sourcepub fn attach_script(&mut self, at: Cursor, which: ScriptSlot) -> Cursor
pub fn attach_script(&mut self, at: Cursor, which: ScriptSlot) -> Cursor
Attaches or moves into a subscript or superscript on the node before the cursor.
Sourcepub fn delete_backward(&mut self, at: Cursor) -> Cursor
pub fn delete_backward(&mut self, at: Cursor) -> Cursor
Deletes backward, escalating empty placeholders and otherwise moving left when no leaf is removed.
Sourcepub fn delete_forward(&mut self, at: Cursor) -> Cursor
pub fn delete_forward(&mut self, at: Cursor) -> Cursor
Deletes forward as the mirror of Tree::delete_backward.
Sourcepub fn delete_selection(&mut self, sel: Selection) -> Cursor
pub fn delete_selection(&mut self, sel: Selection) -> Cursor
Deletes a contiguous selection run within one seq.
Sourcepub fn matrix_shape_at(&self, at: Cursor) -> Option<(usize, usize)>
pub fn matrix_shape_at(&self, at: Cursor) -> Option<(usize, usize)>
Returns the shape of the matrix containing the cursor.
Sourcepub fn matrix_insert_row(&mut self, at: Cursor, side: Side) -> Cursor
pub fn matrix_insert_row(&mut self, at: Cursor, side: Side) -> Cursor
Inserts a matrix row before or after the current row.
Sourcepub fn matrix_delete_row(&mut self, at: Cursor) -> Cursor
pub fn matrix_delete_row(&mut self, at: Cursor) -> Cursor
Deletes the current matrix row when more than one row remains.
Sourcepub fn matrix_insert_col(&mut self, at: Cursor, side: Side) -> Cursor
pub fn matrix_insert_col(&mut self, at: Cursor, side: Side) -> Cursor
Inserts a matrix column before or after the current column.
Sourcepub fn matrix_delete_col(&mut self, at: Cursor) -> Cursor
pub fn matrix_delete_col(&mut self, at: Cursor) -> Cursor
Deletes the current matrix column when more than one column remains.
Sourcepub fn swap_variants(&self, node: NodeId) -> Option<Vec<SwapVariant>>
pub fn swap_variants(&self, node: NodeId) -> Option<Vec<SwapVariant>>
Returns swap menu alternatives for node, excluding its current value.
Sourcepub fn apply_swap(&mut self, node: NodeId, variant: &SwapVariant)
pub fn apply_swap(&mut self, node: NodeId, variant: &SwapVariant)
Applies a chosen alternative by changing only the named tag fields.