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

Method move_left_content

src/text_input.rs:799–825  ·  view source on GitHub ↗

Content-based left movement for `no_styles_movement` mode. Decrements in content space so the cursor skips structural positions.

(&mut self, shift: bool)

Source from the content-addressed store, hash-verified

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) {

Callers 1

move_left_styledMethod · 0.80

Calls 4

cursor_to_contentFunction · 0.85
content_to_cursorFunction · 0.85
selection_rangeMethod · 0.80
cleanup_after_moveMethod · 0.80

Tested by

no test coverage detected