on master help sign in
Allocate the tab stop only once
commit4edfac21f676dcedf39390db989a0327196b31a2 authorBlaž Hrastnik <blaz@mxxn.io> dateSun 27 Jun 2021, 22:50 (5 years ago) parent1b102d5
1 file changed+2−2
helix-term/src/ui/editor.rs+2−2
helix-term/src/ui/editor.rs+2−2
@@ -139,6 +139,7 @@ impl EditorView {
139139 let mut visual_x = 0u16;
140140 let mut line = 0u16;
141141 let tab_width = doc.tab_width();
142+ let tab = " ".repeat(tab_width);
142143
143144 let highlights = highlights.into_iter().map(|event| match event.unwrap() {
144145 // convert byte offsets to char offset
@@ -235,7 +236,6 @@ impl EditorView {
235236 spans.pop();
236237 }
237238 HighlightEvent::Source { start, end } => {
238− // TODO: filter out spans out of viewport for now..
239239 let text = text.slice(start..end);
240240
241241 use helix_core::graphemes::{grapheme_width, RopeGraphemes};
@@ -285,7 +285,7 @@ impl EditorView {
285285 surface.set_string(
286286 viewport.x + visual_x - view.first_col as u16,
287287 viewport.y + line,
288− " ".repeat(tab_width),
288+ &tab,
289289 style,
290290 );
291291