pub struct TextDeleteCmd {
pub target: WidgetId,
pub position: usize,
pub deleted_text: String,
pub metadata: CommandMetadata,
/* private fields */
}Expand description
Command to delete text at a position.
Fields§
§target: WidgetIdTarget widget.
position: usizePosition to delete from (byte offset).
deleted_text: StringDeleted text (for undo).
metadata: CommandMetadataCommand metadata.
Implementations§
Source§impl TextDeleteCmd
impl TextDeleteCmd
Sourcepub fn new(
target: WidgetId,
position: usize,
deleted_text: impl Into<String>,
) -> Self
pub fn new( target: WidgetId, position: usize, deleted_text: impl Into<String>, ) -> Self
Create a new text delete command.
Sourcepub fn with_remove<F>(self, f: F) -> Self
pub fn with_remove<F>(self, f: F) -> Self
Set the remove callback.
Sourcepub fn with_insert<F>(self, f: F) -> Self
pub fn with_insert<F>(self, f: F) -> Self
Set the insert callback (for undo).
Trait Implementations§
Source§impl Debug for TextDeleteCmd
impl Debug for TextDeleteCmd
Source§impl UndoableCmd for TextDeleteCmd
impl UndoableCmd for TextDeleteCmd
Source§fn execute(&mut self) -> CommandResult
fn execute(&mut self) -> CommandResult
Execute the command, applying its effect.
Source§fn undo(&mut self) -> CommandResult
fn undo(&mut self) -> CommandResult
Undo the command, reverting its effect.
Source§fn description(&self) -> &str
fn description(&self) -> &str
Human-readable description for UI display.
Source§fn size_bytes(&self) -> usize
fn size_bytes(&self) -> usize
Size of this command in bytes for memory budgeting.
Source§fn can_merge(&self, other: &dyn UndoableCmd, config: &MergeConfig) -> bool
fn can_merge(&self, other: &dyn UndoableCmd, config: &MergeConfig) -> bool
Check if this command can merge with another.
Source§fn accept_merge(&mut self, other: &dyn UndoableCmd) -> bool
fn accept_merge(&mut self, other: &dyn UndoableCmd) -> bool
Accept a merge from another command. Read more
Source§fn metadata(&self) -> &CommandMetadata
fn metadata(&self) -> &CommandMetadata
Get the command metadata.
Source§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Downcast to mutable concrete type for merging.
Source§fn debug_name(&self) -> &'static str
fn debug_name(&self) -> &'static str
Debug description of the command.
Source§fn redo(&mut self) -> CommandResult
fn redo(&mut self) -> CommandResult
Redo the command after it was undone.
Auto Trait Implementations§
impl Freeze for TextDeleteCmd
impl !RefUnwindSafe for TextDeleteCmd
impl Send for TextDeleteCmd
impl Sync for TextDeleteCmd
impl Unpin for TextDeleteCmd
impl !UnwindSafe for TextDeleteCmd
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
Mutably borrows from an owned value. Read more