MCPcopy Create free account
hub / github.com/TheRedDeveloper/ply-engine / move_left_styled

Method move_left_styled

src/text_input.rs:768–795  ·  view source on GitHub ↗

Move left in styled mode (visual space).

(&mut self, shift: bool)

Source from the content-addressed store, hash-verified

766
767 /// Move left in styled mode (visual space).
768 pub fn move_left_styled(&mut self, shift: bool) {
769 if self.no_styles_movement {
770 return self.move_left_content(shift);
771 }
772 if !shift {
773 if let Some((start, _end)) = self.selection_range() {
774 self.cursor_pos = start;
775 self.selection_anchor = None;
776 self.cleanup_after_move();
777 return;
778 }
779 }
780 if self.cursor_pos > 0 {
781 if shift && self.selection_anchor.is_none() {
782 self.selection_anchor = Some(self.cursor_pos);
783 }
784 self.cursor_pos -= 1;
785 if shift {
786 if self.selection_anchor == Some(self.cursor_pos) {
787 self.selection_anchor = None;
788 }
789 }
790 }
791 if !shift {
792 self.selection_anchor = None;
793 }
794 self.cleanup_after_move();
795 }
796
797 /// Content-based left movement for `no_styles_movement` mode.
798 /// Decrements in content space so the cursor skips structural positions.

Calls 3

move_left_contentMethod · 0.80
selection_rangeMethod · 0.80
cleanup_after_moveMethod · 0.80