on master help sign in
prevent rendering visible whitespace on trailing cursor (#2331)
e4c2618Michael Davis
helix-term/src/ui/editor.rs+3−1
@@ -388,6 +388,8 @@ impl EditorView {
388 spans.pop();
388 spans.pop();
389 }
389 }
390 HighlightEvent::Source { start, end } => {
390 HighlightEvent::Source { start, end } => {
391+ let is_trailing_cursor = text.len_chars() < end;
392+
391 // `unwrap_or_else` part is for off-the-end indices of
393 // `unwrap_or_else` part is for off-the-end indices of
392 // the rope, to allow cursor highlighting at the end
394 // the rope, to allow cursor highlighting at the end
393 // of the rope.
395 // of the rope.
@@ -397,7 +399,7 @@ impl EditorView {
397 .fold(text_style, |acc, span| acc.patch(theme.highlight(span.0)));
399 .fold(text_style, |acc, span| acc.patch(theme.highlight(span.0)));
398
400
399 let space = if whitespace.render.space() == WhitespaceRenderValue::All
401 let space = if whitespace.render.space() == WhitespaceRenderValue::All
400− && text.len_chars() < end
402+ && !is_trailing_cursor
401 {
403 {
402 &space
404 &space
403 } else {
405 } else {