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

Method backspace_word_styled

src/text_input.rs:711–737  ·  view source on GitHub ↗

Backspace word in styled mode.

(&mut self)

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 11

cursor_to_contentFunction · 0.85
strip_stylingFunction · 0.85
find_word_boundary_leftFunction · 0.85
delete_content_rangeFunction · 0.85
content_to_cursorFunction · 0.85
cleanup_empty_stylesFunction · 0.85
delete_visual_rangeFunction · 0.85
snap_to_content_posMethod · 0.80
reset_blinkMethod · 0.80

Tested by

no test coverage detected