(&self)
| 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() |
no test coverage detected