Backspace in styled mode: delete visual char before cursor.
(&mut self)
| 654 | |
| 655 | /// Backspace in styled mode: delete visual char before cursor. |
| 656 | pub fn backspace_styled(&mut self) { |
| 657 | if self.delete_selection_styled() { |
| 658 | return; |
| 659 | } |
| 660 | if self.no_styles_movement { |
| 661 | let cp = styling::cursor_to_content(&self.text, self.cursor_pos); |
| 662 | if cp > 0 { |
| 663 | self.text = styling::delete_content_range(&self.text, cp - 1, cp); |
| 664 | self.cursor_pos = styling::content_to_cursor(&self.text, cp - 1, true); |
| 665 | let (cleaned, new_pos) = styling::cleanup_empty_styles(&self.text, self.cursor_pos); |
| 666 | self.text = cleaned; |
| 667 | self.cursor_pos = new_pos; |
| 668 | self.snap_to_content_pos(); |
| 669 | } |
| 670 | } else if self.cursor_pos > 0 { |
| 671 | self.text = styling::delete_visual_range(&self.text, self.cursor_pos - 1, self.cursor_pos); |
| 672 | self.cursor_pos -= 1; |
| 673 | let (cleaned, new_pos) = styling::cleanup_empty_styles(&self.text, self.cursor_pos); |
| 674 | self.text = cleaned; |
| 675 | self.cursor_pos = new_pos; |
| 676 | } |
| 677 | self.preferred_col = None; |
| 678 | self.reset_blink(); |
| 679 | } |
| 680 | |
| 681 | /// Delete forward in styled mode: delete visual char after cursor. |
| 682 | pub fn delete_forward_styled(&mut self) { |