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

Method backspace_styled

src/text_input.rs:656–679  ·  view source on GitHub ↗

Backspace in styled mode: delete visual char before cursor.

(&mut self)

Source from the content-addressed store, hash-verified

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

Callers 2

test_no_styles_backspaceFunction · 0.80

Calls 8

cursor_to_contentFunction · 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 1

test_no_styles_backspaceFunction · 0.64