diff options
author | Blaž Hrastnik | 2021-06-27 13:50:42 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-06-27 14:28:22 +0000 |
commit | 4edfac21f676dcedf39390db989a0327196b31a2 (patch) | |
tree | 696c0b1e14a65af5fbd563985c7dbcd7a7e0f196 | |
parent | 1b102d553277c1227101df0767d5b186888e13a0 (diff) |
Allocate the tab stop only once
-rw-r--r-- | helix-term/src/ui/editor.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index 1211fc65..753af2cb 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, ); |