From 4edfac21f676dcedf39390db989a0327196b31a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Sun, 27 Jun 2021 22:50:42 +0900 Subject: [PATCH] Allocate the tab stop only once --- helix-term/src/ui/editor.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index 1211fc65c..753af2cbe 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -139,6 +139,7 @@ impl EditorView { let mut visual_x = 0u16; let mut line = 0u16; let tab_width = doc.tab_width(); + let tab = " ".repeat(tab_width); let highlights = highlights.into_iter().map(|event| match event.unwrap() { // convert byte offsets to char offset @@ -235,7 +236,6 @@ impl EditorView { spans.pop(); } HighlightEvent::Source { start, end } => { - // TODO: filter out spans out of viewport for now.. let text = text.slice(start..end); use helix_core::graphemes::{grapheme_width, RopeGraphemes}; @@ -285,7 +285,7 @@ impl EditorView { surface.set_string( viewport.x + visual_x - view.first_col as u16, viewport.y + line, - " ".repeat(tab_width), + &tab, style, );