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

Method selected_text_styled

src/text_input.rs:572–581  ·  view source on GitHub ↗

Get the selected text in visual space, returning the visible chars.

(&self)

Source from the content-addressed store, hash-verified

570
571 /// Get the selected text in visual space, returning the visible chars.
572 pub fn selected_text_styled(&self) -> String {
573 if let Some((start, end)) = self.selection_range() {
574 let stripped = styling::strip_styling(&self.text);
575 let byte_start = char_index_to_byte(&stripped, start);
576 let byte_end = char_index_to_byte(&stripped, end);
577 stripped[byte_start..byte_end].to_string()
578 } else {
579 String::new()
580 }
581 }
582
583 /// Delete selection in styled mode. Returns true if a selection was deleted.
584 pub fn delete_selection_styled(&mut self) -> bool {

Callers 1

beginMethod · 0.80

Calls 3

strip_stylingFunction · 0.85
char_index_to_byteFunction · 0.85
selection_rangeMethod · 0.80

Tested by

no test coverage detected