diff options
author | Aleksey Kladov <[email protected]> | 2019-01-08 18:50:04 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-01-08 18:50:04 +0000 |
commit | f553837c1ca30a52bf5091689c21d3c3e3362395 (patch) | |
tree | 79dbabf6137e6aaf64d494f57a7cecbf397237bc /crates/ra_text_edit/src | |
parent | c9e42fcf245be16958dca6571e4bccc6c29199df (diff) |
upstream text-utils to text_unit
Diffstat (limited to 'crates/ra_text_edit/src')
-rw-r--r-- | crates/ra_text_edit/src/lib.rs | 1 | ||||
-rw-r--r-- | crates/ra_text_edit/src/text_edit.rs | 3 | ||||
-rw-r--r-- | crates/ra_text_edit/src/text_utils.rs | 5 |
3 files changed, 1 insertions, 8 deletions
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 @@ | |||
1 | mod text_edit; | 1 | mod text_edit; |
2 | pub mod text_utils; | ||
3 | pub mod test_utils; | 2 | pub mod test_utils; |
4 | 3 | ||
5 | pub use crate::text_edit::{TextEdit, TextEditBuilder}; | 4 | pub 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 @@ | |||
1 | use crate::AtomTextEdit; | 1 | use crate::AtomTextEdit; |
2 | use crate::text_utils::contains_offset_nonstrict; | ||
3 | use text_unit::{TextRange, TextUnit}; | 2 | use 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 @@ | |||
1 | use text_unit::{TextRange, TextUnit}; | ||
2 | |||
3 | pub fn contains_offset_nonstrict(range: TextRange, offset: TextUnit) -> bool { | ||
4 | range.start() <= offset && offset <= range.end() | ||
5 | } | ||