aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_text_edit
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-01-08 18:50:04 +0000
committerAleksey Kladov <[email protected]>2019-01-08 18:50:04 +0000
commitf553837c1ca30a52bf5091689c21d3c3e3362395 (patch)
tree79dbabf6137e6aaf64d494f57a7cecbf397237bc /crates/ra_text_edit
parentc9e42fcf245be16958dca6571e4bccc6c29199df (diff)
upstream text-utils to text_unit
Diffstat (limited to 'crates/ra_text_edit')
-rw-r--r--crates/ra_text_edit/Cargo.toml2
-rw-r--r--crates/ra_text_edit/src/lib.rs1
-rw-r--r--crates/ra_text_edit/src/text_edit.rs3
-rw-r--r--crates/ra_text_edit/src/text_utils.rs5
4 files changed, 2 insertions, 9 deletions
diff --git a/crates/ra_text_edit/Cargo.toml b/crates/ra_text_edit/Cargo.toml
index e0db49688..71f6ce1ad 100644
--- a/crates/ra_text_edit/Cargo.toml
+++ b/crates/ra_text_edit/Cargo.toml
@@ -6,7 +6,7 @@ authors = ["Aleksey Kladov <[email protected]>"]
6publish = false 6publish = false
7 7
8[dependencies] 8[dependencies]
9text_unit = "0.1.5" 9text_unit = "0.1.6"
10proptest = "0.8.7" 10proptest = "0.8.7"
11 11
12[dev-dependencies] 12[dev-dependencies]
diff --git a/crates/ra_text_edit/src/lib.rs b/crates/ra_text_edit/src/lib.rs
index 8acf10448..22f3fdc0c 100644
--- a/crates/ra_text_edit/src/lib.rs
+++ b/crates/ra_text_edit/src/lib.rs
@@ -1,5 +1,4 @@
1mod text_edit; 1mod text_edit;
2pub mod text_utils;
3pub mod test_utils; 2pub mod test_utils;
4 3
5pub use crate::text_edit::{TextEdit, TextEditBuilder}; 4pub use crate::text_edit::{TextEdit, TextEditBuilder};
diff --git a/crates/ra_text_edit/src/text_edit.rs b/crates/ra_text_edit/src/text_edit.rs
index a288a990d..363b3d8c0 100644
--- a/crates/ra_text_edit/src/text_edit.rs
+++ b/crates/ra_text_edit/src/text_edit.rs
@@ -1,5 +1,4 @@
1use crate::AtomTextEdit; 1use crate::AtomTextEdit;
2use crate::text_utils::contains_offset_nonstrict;
3use text_unit::{TextRange, TextUnit}; 2use text_unit::{TextRange, TextUnit};
4 3
5#[derive(Debug, Clone)] 4#[derive(Debug, Clone)]
@@ -28,7 +27,7 @@ impl TextEditBuilder {
28 pub fn invalidates_offset(&self, offset: TextUnit) -> bool { 27 pub fn invalidates_offset(&self, offset: TextUnit) -> bool {
29 self.atoms 28 self.atoms
30 .iter() 29 .iter()
31 .any(|atom| contains_offset_nonstrict(atom.delete, offset)) 30 .any(|atom| atom.delete.contains_inclusive(offset))
32 } 31 }
33} 32}
34 33
diff --git a/crates/ra_text_edit/src/text_utils.rs b/crates/ra_text_edit/src/text_utils.rs
deleted file mode 100644
index e3b4dc4fe..000000000
--- a/crates/ra_text_edit/src/text_utils.rs
+++ /dev/null
@@ -1,5 +0,0 @@
1use text_unit::{TextRange, TextUnit};
2
3pub fn contains_offset_nonstrict(range: TextRange, offset: TextUnit) -> bool {
4 range.start() <= offset && offset <= range.end()
5}