aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_editor/src/line_index.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_editor/src/line_index.rs')
-rw-r--r--crates/ra_editor/src/line_index.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/crates/ra_editor/src/line_index.rs b/crates/ra_editor/src/line_index.rs
index 7d9b8d79f..c29e2e49a 100644
--- a/crates/ra_editor/src/line_index.rs
+++ b/crates/ra_editor/src/line_index.rs
@@ -15,9 +15,9 @@ pub struct LineCol {
15} 15}
16 16
17#[derive(Clone, Debug, Hash, PartialEq, Eq)] 17#[derive(Clone, Debug, Hash, PartialEq, Eq)]
18struct Utf16Char { 18pub(crate) struct Utf16Char {
19 start: TextUnit, 19 pub(crate) start: TextUnit,
20 end: TextUnit, 20 pub(crate) end: TextUnit,
21} 21}
22 22
23impl Utf16Char { 23impl Utf16Char {
@@ -122,7 +122,13 @@ impl LineIndex {
122 } 122 }
123 123
124 pub(crate) fn newlines(&self) -> &[TextUnit] { 124 pub(crate) fn newlines(&self) -> &[TextUnit] {
125 &self.newlines[1..] 125 &self.newlines[..]
126 }
127
128 pub(crate) fn utf16_chars(&self, newline_idx: usize) -> Option<&[Utf16Char]> {
129 self.utf16_lines
130 .get(&(newline_idx as u32))
131 .map(|x| x.as_slice())
126 } 132 }
127} 133}
128 134