@@ -183,6 +183,7 @@ impl EditorView {
183 .highlight_iter(text.slice(..), Some(range), None)
183 .highlight_iter(text.slice(..), Some(range), None)
184 .map(|event| event.unwrap())
184 .map(|event| event.unwrap())
185 .map(move |event| match event {
185 .map(move |event| match event {
186+ // TODO: use byte slices directly
186 // convert byte offsets to char offset
187 // convert byte offsets to char offset
187 HighlightEvent::Source { start, end } => {
188 HighlightEvent::Source { start, end } => {
188 let start =
189 let start =
@@ -317,6 +318,8 @@ impl EditorView {
317 theme: &Theme,
318 theme: &Theme,
318 highlights: H,
319 highlights: H,
321+ // It's slightly more efficient to produce a full RopeSlice from the Rope, then slice that a bunch
322+ // of times than it is to always call Rope::slice/get_slice (it will internally always hit RSEnum::Light).
320 let text = doc.text().slice(..);
323 let text = doc.text().slice(..);
322 let mut spans = Vec::new();
325 let mut spans = Vec::new();
@@ -327,10 +330,6 @@ impl EditorView {
328 let text_style = theme.get("ui.text");
331 let text_style = theme.get("ui.text");
330− // It's slightly more efficient to produce a full RopeSlice from the Rope, then slice that a bunch
331− // of times than it is to always call Rope::slice/get_slice (it will internally always hit RSEnum::Light).
332− let text = text.slice(..);
334 'outer: for event in highlights {
333 'outer: for event in highlights {
335 match event {
334 match event {
336 HighlightEvent::HighlightStart(span) => {
335 HighlightEvent::HighlightStart(span) => {