aboutsummaryrefslogtreecommitdiff
path: root/helix-core
diff options
context:
space:
mode:
Diffstat (limited to 'helix-core')
-rw-r--r--helix-core/Cargo.toml3
-rw-r--r--helix-core/src/graphemes.rs5
-rw-r--r--helix-core/src/syntax.rs8
3 files changed, 5 insertions, 11 deletions
diff --git a/helix-core/Cargo.toml b/helix-core/Cargo.toml
index 8152da57..3e5aabaa 100644
--- a/helix-core/Cargo.toml
+++ b/helix-core/Cargo.toml
@@ -15,7 +15,8 @@ include = ["src/**/*", "README.md"]
[dependencies]
helix-loader = { version = "0.6", path = "../helix-loader" }
-ropey = "1.3"
+# ropey = "1.3"
+ropey = { git = "https://github.com/cessen/ropey" }
smallvec = "1.8"
smartstring = "1.0.0"
unicode-segmentation = "1.9"
diff --git a/helix-core/src/graphemes.rs b/helix-core/src/graphemes.rs
index aa898684..c0c61775 100644
--- a/helix-core/src/graphemes.rs
+++ b/helix-core/src/graphemes.rs
@@ -333,10 +333,7 @@ impl<'a> Iterator for RopeGraphemes<'a> {
}
if a < self.cur_chunk_start {
- let a_char = self.text.byte_to_char(a);
- let b_char = self.text.byte_to_char(b);
-
- Some(self.text.slice(a_char..b_char))
+ Some(self.text.byte_slice(a..b))
} else {
let a2 = a - self.cur_chunk_start;
let b2 = b - self.cur_chunk_start;
diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs
index 3fc91efc..f76683b9 100644
--- a/helix-core/src/syntax.rs
+++ b/helix-core/src/syntax.rs
@@ -576,9 +576,7 @@ pub struct Syntax {
}
fn byte_range_to_str(range: std::ops::Range<usize>, source: RopeSlice) -> Cow<str> {
- let start_char = source.byte_to_char(range.start);
- let end_char = source.byte_to_char(range.end);
- Cow::from(source.slice(start_char..end_char))
+ Cow::from(source.byte_slice(range))
}
impl Syntax {
@@ -1197,9 +1195,7 @@ impl<'a> TextProvider<'a> for RopeProvider<'a> {
type I = ChunksBytes<'a>;
fn text(&mut self, node: Node) -> Self::I {
- let start_char = self.0.byte_to_char(node.start_byte());
- let end_char = self.0.byte_to_char(node.end_byte());
- let fragment = self.0.slice(start_char..end_char);
+ let fragment = self.0.byte_slice(node.start_byte()..node.end_byte());
ChunksBytes {
chunks: fragment.chunks(),
}