MCPcopy Create free account
hub / github.com/Eeive/Evcode-ide / selected_text

Method selected_text

src/editor/buffer.rs:120–126  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

118 }
119
120 pub fn selected_text(&self) -> Option<String> {
121 let (start, end) = self.selection_range()?;
122 let start_idx = self.document.position_to_char(start.0, start.1);
123 let end_idx = self.document.position_to_char(end.0, end.1);
124 let text = self.document.slice_text(start_idx, end_idx);
125 (!text.is_empty()).then_some(text)
126 }
127
128 pub fn text(&self) -> String {
129 self.document.to_string()

Callers 1

get_selected_textMethod · 0.80

Calls 4

selection_rangeMethod · 0.80
position_to_charMethod · 0.80
slice_textMethod · 0.80
is_emptyMethod · 0.80

Tested by

no test coverage detected