pub struct Editing {
pub on: bool,
pub asking: bool,
/* private fields */
}Expand description
The shell’s editing state, handed to the view on every frame.
Fields§
§on: boolWhether the window is in edit mode. Outside it a view draws and selects and never opens an editor.
asking: boolA question is up over the window, and the keys belong to it: a view does not open an editor on the Enter that answers it.
Implementations§
Source§impl Editing
impl Editing
Sourcepub fn record(&mut self, content: &Element)
pub fn record(&mut self, content: &Element)
Take a snapshot of the content tree before an edit changes it.
Every edit calls this first, with the tree as it stands, and then mutates. A redo history is discarded, because the edit that follows is a new branch.
Sourcepub fn record_snapshot(&mut self, content: Element, caret: Option<Caret>)
pub fn record_snapshot(&mut self, content: Element, caret: Option<Caret>)
The same, for a snapshot already taken, with where the caret stood in it: an editor that learns only after an edit whether it succeeded takes the tree before trying, and records it once it has.
Sourcepub fn undo(
&mut self,
current: &Element,
caret: Option<Caret>,
) -> Option<(Element, Option<Caret>)>
pub fn undo( &mut self, current: &Element, caret: Option<Caret>, ) -> Option<(Element, Option<Caret>)>
Take the last edit back. Given the tree as it stands and where the caret is, so that the edit can be redone; answers the tree to put in its place and where the caret was in it.
Sourcepub fn redo(
&mut self,
current: &Element,
caret: Option<Caret>,
) -> Option<(Element, Option<Caret>)>
pub fn redo( &mut self, current: &Element, caret: Option<Caret>, ) -> Option<(Element, Option<Caret>)>
Put back the edit last taken back, the same way.
Sourcepub fn modified(&self) -> bool
pub fn modified(&self) -> bool
Whether the document differs from the file it was read from or last saved to. Undoing back to that state answers false again.
Sourcepub fn mark_saved(&mut self)
pub fn mark_saved(&mut self)
The document was written: what it holds now is what the file holds.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Editing
impl RefUnwindSafe for Editing
impl Send for Editing
impl Sync for Editing
impl Unpin for Editing
impl UnsafeUnpin for Editing
impl UnwindSafe for Editing
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&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> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more