aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Davis2022-04-30 00:48:11 +0000
committerGitHub2022-04-30 00:48:11 +0000
commite4c261809980fa17436a8e87cf7e56ddda8bcb68 (patch)
treed6386c3587571fc3329eca20119e6ac1eef7a060
parent2687b8fb3b3391b6104815afca47704187f22cb8 (diff)
prevent rendering visible whitespace on trailing cursor (#2331)
-rw-r--r--helix-term/src/ui/editor.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs
index ce8746a7..5ceff39e 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 {