Skip to main content

Action

Enum Action 

Source
pub enum Action {
Show 46 variants Type(char), Backspace, Delete, DeleteWordBack, DeleteWordForward, Enter, Tab, Outdent, ToggleComment, DeleteLine, InsertLine { down: bool, }, Cut, Paste { text: String, entire_line: bool, }, Move { motion: Motion, extend: bool, }, PlaceCaret(u32), DragSelect { granularity: Granularity, origin: u32, head: u32, }, AddCaret(u32), AddNextOccurrence, SelectAllOccurrences, AddCaretVertical { down: bool, }, JumpToBracket, ExpandSelection, ShrinkSelection, Collapse, SelectAll, Undo, Redo, ColumnSelect(ColumnDir), ColumnDrag { anchor: (u32, u32), active: (u32, u32), }, MoveLine { down: bool, }, CopyLine { down: bool, }, ViewportChanged(Range<u32>), PopupUp, PopupDown, PopupAccept, PopupClickAccept(u32), PopupDismiss, SnippetTab, SnippetTabPrev, SnippetCancel, SignatureClose, NextDiagnostic { forward: bool, }, HoverQuery(u32), HoverDismiss, ToggleFold { opener: u32, }, FoldAtCarets { unfold: bool, },
}
Expand description

A semantic editor action produced by the widget for the app to apply to its Document — an edit verb or a caret motion.

Variants§

§

Type(char)

Insert a typed character (replacing any selection).

§

Backspace

Backspace.

§

Delete

Forward delete.

§

DeleteWordBack

Delete the word before the caret (Ctrl+Backspace).

§

DeleteWordForward

Delete the word after the caret (Ctrl+Delete).

§

Enter

Split the line (Enter).

§

Tab

Indent / insert-to-tab-stop (Tab).

§

Outdent

Outdent to the previous tab stop (Shift+Tab).

§

ToggleComment

Toggle the language’s line comment on the spanned lines (Ctrl+/).

§

DeleteLine

Delete each selection’s whole-line block (Ctrl+Shift+K).

§

InsertLine

Open a fresh indent-carrying line below (Ctrl+Enter) or above (Ctrl+Shift+Enter) the caret’s line, caret landing on it.

Fields

§down: bool

Below if true, above if false.

§

Cut

Cut’s edit half (the copy half runs in the widget): delete each selection, an empty caret expanding to its whole line.

§

Paste

Insert clipboard text at the carets (Paste).

Fields

§text: String

The pasted text (the core normalizes CRLF to LF).

§entire_line: bool

Whether this is our own whole-line copy (recognized from a side table) — pasted above the caret’s line, caret staying put.

§

Move

Move (or, with extend, drag) every caret.

Fields

§motion: Motion

Which motion.

§extend: bool

Extend the selection instead of collapsing.

§

PlaceCaret(u32)

Place a single caret at a byte offset (mouse click).

§

DragSelect

Drag-select from origin to head at a granularity — the click-drag family. head == origin is the double/triple-click initial selection; Word/Line drags extend by whole units keeping the origin unit selected.

Fields

§granularity: Granularity

Character / word / line units.

§origin: u32

The fixed origin (where the gesture began).

§head: u32

The moving end (the cursor).

§

AddCaret(u32)

Add a caret at a byte offset (Alt+Click), keeping existing selections.

§

AddNextOccurrence

Add the next occurrence of the selection as a new caret (Ctrl+D).

§

SelectAllOccurrences

Select every occurrence of the selection (Ctrl+Shift+L).

§

AddCaretVertical

Add a caret one display row above/below every caret (Ctrl+Alt+↑/↓).

Fields

§down: bool

Below if true, above if false.

§

JumpToBracket

Jump each caret to its matching bracket (Ctrl+Shift+).

§

ExpandSelection

Grow each selection one structural step (Shift+Alt+Right).

§

ShrinkSelection

Walk back down the expansion ladder (Shift+Alt+Left).

§

Collapse

Collapse a multi-cursor set (or a range) to the primary caret (Escape).

§

SelectAll

Select the whole document (Ctrl+A).

§

Undo

Undo the last edit (Ctrl+Z).

§

Redo

Redo the last undone edit (Ctrl+Shift+Z / Ctrl+Y).

§

ColumnSelect(ColumnDir)

Grow/shrink the column (box) selection (Ctrl+Shift+Alt+Arrow).

§

ColumnDrag

Mouse box (column) selection drag (Shift+Alt+drag): corners as (visible buffer row, virtual display cell) — the core resolves the cells per spanned display row and clamps each to its line.

Fields

§anchor: (u32, u32)

The fixed corner (row, display cell).

§active: (u32, u32)

The moving corner (row, display cell).

§

MoveLine

Move the selected line-block up/down (Alt+↑/↓).

Fields

§down: bool

Down if true, up if false.

§

CopyLine

Duplicate the selected line-block above/below (Shift+Alt+↑/↓).

Fields

§down: bool

Below if true, above if false.

§

ViewportChanged(Range<u32>)

The visible buffer-row range changed (scroll / resize / autoscroll), margin included. The app aims the highlight retention window here (Document::set_highlight_window) and tokenizes highlights down to its end — the view reports its viewport to the model so highlighting only ever runs for what is on screen (see update). Not an edit: it never moves a caret or touches history.

§

PopupUp

Move the completion popup’s selection up / down. Published (and the key captured) only while the popup is open; the app drives the controller.

§

PopupDown

See PopupUp.

§

PopupAccept

Accept the popup’s selected item (Enter / Tab).

§

PopupClickAccept(u32)

Accept the popup row at this filtered-list index (a mouse click on it).

§

PopupDismiss

Dismiss the popup (Escape) — sticky until a word boundary.

§

SnippetTab

Advance / retreat the active snippet tab stop (Tab / Shift+Tab). Captured only while a session is active; the app drives it.

§

SnippetTabPrev

§

SnippetCancel

Cancel the snippet session (Escape).

§

SignatureClose

Close the signature-help box (Escape — after the popup, before the snippet session, in dismissal order).

§

NextDiagnostic

Jump to the next/previous diagnostic (F8 / Shift+F8).

Fields

§forward: bool

Forward if true (F8), backward if false (Shift+F8).

§

HoverQuery(u32)

The pointer rested over byte offset long enough for a hover query. The app resolves the word + queries its provider.

§

HoverDismiss

Close the hover popup (pointer left the word).

§

ToggleFold

Toggle the fold whose pair opens at byte offset opener — a gutter-chevron click or Ctrl+Shift+[/]. The app calls Document::toggle_fold_opener; not an edit (folds are view state, never on the undo stack). Keyed by the opener so a single-line row with two [..] pairs stays unambiguous.

Fields

§opener: u32

Byte offset of the fold’s opening bracket.

§

FoldAtCarets

Fold (unfold == false) or unfold (unfold == true) the block at EVERY caret — Ctrl+Shift+[ / Ctrl+Shift+]. The app calls Document::fold_at_carets; not an edit (folds are view state). Distinct from Action::ToggleFold, which acts on one gutter-clicked opener.

Fields

§unfold: bool

true = unfold (Ctrl+Shift+]), false = fold (Ctrl+Shift+[).

Trait Implementations§

Source§

impl Clone for Action

Source§

fn clone(&self) -> Action

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 Action

Source§

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

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

impl PartialEq for Action

Source§

fn eq(&self, other: &Action) -> 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 Action

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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<State, Message> IntoBoot<State, Message> for State

Source§

fn into_boot(self) -> (State, Task<Message>)

Turns some type into the initial state of some Application.
Source§

impl<T> MaybeClone for T

Source§

impl<T> MaybeDebug for T

Source§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<T> MaybeSync for T
where T: Sync,

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more