From e4c261809980fa17436a8e87cf7e56ddda8bcb68 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Fri, 29 Apr 2022 19:48:11 -0500 Subject: [PATCH] prevent rendering visible whitespace on trailing cursor (#2331) --- helix-term/src/ui/editor.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index ce8746a75..5ceff39e5 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -388,6 +388,8 @@ impl EditorView { spans.pop(); } HighlightEvent::Source { start, end } => { + let is_trailing_cursor = text.len_chars() < end; + // `unwrap_or_else` part is for off-the-end indices of // the rope, to allow cursor highlighting at the end // of the rope. @@ -397,7 +399,7 @@ impl EditorView { .fold(text_style, |acc, span| acc.patch(theme.highlight(span.0))); let space = if whitespace.render.space() == WhitespaceRenderValue::All - && text.len_chars() < end + && !is_trailing_cursor { &space } else {