Backspace word in styled mode.
(&mut self)
| 709 | |
| 710 | /// Backspace word in styled mode. |
| 711 | pub fn backspace_word_styled(&mut self) { |
| 712 | if self.delete_selection_styled() { |
| 713 | return; |
| 714 | } |
| 715 | if self.no_styles_movement { |
| 716 | let cp = styling::cursor_to_content(&self.text, self.cursor_pos); |
| 717 | let stripped = styling::strip_styling(&self.text); |
| 718 | let target_cp = find_word_boundary_left(&stripped, cp); |
| 719 | if target_cp < cp { |
| 720 | self.text = styling::delete_content_range(&self.text, target_cp, cp); |
| 721 | self.cursor_pos = styling::content_to_cursor(&self.text, target_cp, true); |
| 722 | let (cleaned, new_pos) = styling::cleanup_empty_styles(&self.text, self.cursor_pos); |
| 723 | self.text = cleaned; |
| 724 | self.cursor_pos = new_pos; |
| 725 | self.snap_to_content_pos(); |
| 726 | } |
| 727 | } else { |
| 728 | let target = styling::find_word_boundary_left_visual(&self.text, self.cursor_pos); |
| 729 | self.text = styling::delete_visual_range(&self.text, target, self.cursor_pos); |
| 730 | self.cursor_pos = target; |
| 731 | let (cleaned, new_pos) = styling::cleanup_empty_styles(&self.text, self.cursor_pos); |
| 732 | self.text = cleaned; |
| 733 | self.cursor_pos = new_pos; |
| 734 | } |
| 735 | self.preferred_col = None; |
| 736 | self.reset_blink(); |
| 737 | } |
| 738 | |
| 739 | /// Delete word forward in styled mode. |
| 740 | pub fn delete_word_forward_styled(&mut self) { |
no test coverage detected