diff --git a/crates/wysiwyg/src/composer_model/delete_text.rs b/crates/wysiwyg/src/composer_model/delete_text.rs index 009ef48f5..24f36d6e8 100644 --- a/crates/wysiwyg/src/composer_model/delete_text.rs +++ b/crates/wysiwyg/src/composer_model/delete_text.rs @@ -261,17 +261,17 @@ where node.offset_is_inside_node(current_offset, &direction); // delete to the cursor - self.delete_to_cursor(current_position); + let update = self.delete_to_cursor(current_position); // if we have stopped inside the node and we didn't start at whitespace, stop if offset_is_inside_node && start_type != CharType::Whitespace { - return ComposerUpdate::keep(); + return update; } // otherwise make a recursive call let next_args = self.get_remove_word_arguments(&direction); match next_args { - None => ComposerUpdate::keep(), + None => update, Some(args) => { let (location, next_type) = args; let type_argument = if offset_is_inside_node { diff --git a/crates/wysiwyg/src/tests/test_deleting.rs b/crates/wysiwyg/src/tests/test_deleting.rs index 68f8dd381..1e8ee99fd 100644 --- a/crates/wysiwyg/src/tests/test_deleting.rs +++ b/crates/wysiwyg/src/tests/test_deleting.rs @@ -926,6 +926,13 @@ fn backspace_mention_from_end() { assert_eq!(restore_whitespace(&tx(&model)), "|"); } +#[test] +fn backspace_word_returns_replace_all_update() { + let mut model = cm("Some text with multiple words|"); + let update = model.backspace_word(); + assert!(matches!(update.text_update, TextUpdate::ReplaceAll(_))) +} + #[test] fn delete_immutable_link_from_edge_of_link() { let mut model = cm(