Content-based left movement for `no_styles_movement` mode. Decrements in content space so the cursor skips structural positions.
(&mut self, shift: bool)
| 797 | /// Content-based left movement for `no_styles_movement` mode. |
| 798 | /// Decrements in content space so the cursor skips structural positions. |
| 799 | fn move_left_content(&mut self, shift: bool) { |
| 800 | let cp = styling::cursor_to_content(&self.text, self.cursor_pos); |
| 801 | if !shift { |
| 802 | if let Some((start, _end)) = self.selection_range() { |
| 803 | let sc = styling::cursor_to_content(&self.text, start); |
| 804 | self.cursor_pos = styling::content_to_cursor(&self.text, sc, true); |
| 805 | self.selection_anchor = None; |
| 806 | self.cleanup_after_move(); |
| 807 | return; |
| 808 | } |
| 809 | } |
| 810 | if cp > 0 { |
| 811 | if shift && self.selection_anchor.is_none() { |
| 812 | self.selection_anchor = Some(self.cursor_pos); |
| 813 | } |
| 814 | self.cursor_pos = styling::content_to_cursor(&self.text, cp - 1, true); |
| 815 | if shift { |
| 816 | if self.selection_anchor == Some(self.cursor_pos) { |
| 817 | self.selection_anchor = None; |
| 818 | } |
| 819 | } |
| 820 | } |
| 821 | if !shift { |
| 822 | self.selection_anchor = None; |
| 823 | } |
| 824 | self.cleanup_after_move(); |
| 825 | } |
| 826 | |
| 827 | /// Move right in styled mode (visual space). |
| 828 | pub fn move_right_styled(&mut self, shift: bool) { |
no test coverage detected