kill text utils

This commit is contained in:
Aleksey Kladov 2019-01-08 21:59:55 +03:00
parent f553837c1c
commit 921689b70d
4 changed files with 13 additions and 19 deletions

View file

@ -28,4 +28,11 @@ impl AtomTextEdit {
pub fn insert(offset: TextUnit, text: String) -> AtomTextEdit {
AtomTextEdit::replace(TextRange::offset_len(offset, 0.into()), text)
}
pub fn apply(&self, mut text: String) -> String {
let start = u32::from(self.delete.start()) as usize;
let end = u32::from(self.delete.end()) as usize;
text.replace_range(start..end, &self.insert);
text
}
}