aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_text_edit
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-01-08 18:59:55 +0000
committerAleksey Kladov <[email protected]>2019-01-08 19:03:13 +0000
commit921689b70da39160dd381e9716472827e36b03b8 (patch)
treea390d74ee5272a4a0070f5d4ea5281a04d4ba56a /crates/ra_text_edit
parentf553837c1ca30a52bf5091689c21d3c3e3362395 (diff)
kill text utils
Diffstat (limited to 'crates/ra_text_edit')
-rw-r--r--crates/ra_text_edit/src/lib.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/crates/ra_text_edit/src/lib.rs b/crates/ra_text_edit/src/lib.rs
index 22f3fdc0c..fb693b3ae 100644
--- a/crates/ra_text_edit/src/lib.rs
+++ b/crates/ra_text_edit/src/lib.rs
@@ -28,4 +28,11 @@ impl AtomTextEdit {
28 pub fn insert(offset: TextUnit, text: String) -> AtomTextEdit { 28 pub fn insert(offset: TextUnit, text: String) -> AtomTextEdit {
29 AtomTextEdit::replace(TextRange::offset_len(offset, 0.into()), text) 29 AtomTextEdit::replace(TextRange::offset_len(offset, 0.into()), text)
30 } 30 }
31
32 pub fn apply(&self, mut text: String) -> String {
33 let start = u32::from(self.delete.start()) as usize;
34 let end = u32::from(self.delete.end()) as usize;
35 text.replace_range(start..end, &self.insert);
36 text
37 }
31} 38}