(&mut self)
| 358 | } |
| 359 | |
| 360 | fn take_selection(&mut self) -> (Option<usize>, String) { |
| 361 | let Some((start, end)) = self.selection_range() else { |
| 362 | return (None, String::new()); |
| 363 | }; |
| 364 | let start_idx = self.document.position_to_char(start.0, start.1); |
| 365 | let end_idx = self.document.position_to_char(end.0, end.1); |
| 366 | let deleted = self.document.slice_text(start_idx, end_idx); |
| 367 | self.document.remove_char_range(start_idx, end_idx); |
| 368 | self.cursor = self.cursor.set(start.0, start.1, &self.document); |
| 369 | self.selection_anchor = None; |
| 370 | (Some(start_idx), deleted) |
| 371 | } |
| 372 | |
| 373 | fn cursor_char_idx(&self) -> usize { |
| 374 | self.document |
no test coverage detected