Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/core_editor/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ impl Editor {
let deleted_char = self.edit_stack.current().grapheme_left().chars().next();
UndoBehavior::Backspace(deleted_char)
}
(_, EditType::UndoRedo) => UndoBehavior::UndoRedo,
(_, EditType::UndoRedo | EditType::NoOp) => UndoBehavior::NoOp,
(_, _) => UndoBehavior::CreateUndoPoint,
};

Expand Down Expand Up @@ -307,8 +307,8 @@ impl Editor {
}

pub(crate) fn update_undo_state(&mut self, undo_behavior: UndoBehavior) {
if matches!(undo_behavior, UndoBehavior::UndoRedo) {
self.last_undo_behavior = UndoBehavior::UndoRedo;
if matches!(undo_behavior, UndoBehavior::NoOp) {
self.last_undo_behavior = UndoBehavior::NoOp;
return;
}
if !undo_behavior.create_undo_point_after(&self.last_undo_behavior) {
Expand Down
8 changes: 4 additions & 4 deletions src/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -615,9 +615,9 @@ impl EditCommand {
#[cfg(feature = "system_clipboard")]
EditCommand::CopySelectionSystem => EditType::NoOp,
EditCommand::CutInsidePair { .. } => EditType::EditText,
EditCommand::CopyInsidePair { .. } => EditType::EditText,
EditCommand::CopyInsidePair { .. } => EditType::NoOp,
EditCommand::CutAroundPair { .. } => EditType::EditText,
EditCommand::CopyAroundPair { .. } => EditType::EditText,
EditCommand::CopyAroundPair { .. } => EditType::NoOp,
EditCommand::CutTextObject { .. } => EditType::EditText,
EditCommand::CopyTextObject { .. } => EditType::NoOp,
EditCommand::CopyFromStart
Expand Down Expand Up @@ -674,8 +674,8 @@ pub enum UndoBehavior {
/// Catch-all for actions that should always form a unique undo point and never be
/// grouped with later edits
CreateUndoPoint,
/// Undo/Redo actions shouldn't be reflected on the edit stack
UndoRedo,
/// For actions that shouldn't be reflected on the edit stack e.g. Undo/Redo
NoOp,
}

impl UndoBehavior {
Expand Down