Allocate the tab stop only once

imgbot
Blaž Hrastnik 4 years ago
parent 1b102d5532
commit 4edfac21f6

@ -139,6 +139,7 @@ impl EditorView {
let mut visual_x = 0u16; let mut visual_x = 0u16;
let mut line = 0u16; let mut line = 0u16;
let tab_width = doc.tab_width(); let tab_width = doc.tab_width();
let tab = " ".repeat(tab_width);
let highlights = highlights.into_iter().map(|event| match event.unwrap() { let highlights = highlights.into_iter().map(|event| match event.unwrap() {
// convert byte offsets to char offset // convert byte offsets to char offset
@ -235,7 +236,6 @@ impl EditorView {
spans.pop(); spans.pop();
} }
HighlightEvent::Source { start, end } => { HighlightEvent::Source { start, end } => {
// TODO: filter out spans out of viewport for now..
let text = text.slice(start..end); let text = text.slice(start..end);
use helix_core::graphemes::{grapheme_width, RopeGraphemes}; use helix_core::graphemes::{grapheme_width, RopeGraphemes};
@ -285,7 +285,7 @@ impl EditorView {
surface.set_string( surface.set_string(
viewport.x + visual_x - view.first_col as u16, viewport.x + visual_x - view.first_col as u16,
viewport.y + line, viewport.y + line,
" ".repeat(tab_width), &tab,
style, style,
); );

Loading…
Cancel
Save