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