diff options
author | Michael Davis | 2022-04-30 00:48:11 +0000 |
---|---|---|
committer | GitHub | 2022-04-30 00:48:11 +0000 |
commit | e4c261809980fa17436a8e87cf7e56ddda8bcb68 (patch) | |
tree | d6386c3587571fc3329eca20119e6ac1eef7a060 | |
parent | 2687b8fb3b3391b6104815afca47704187f22cb8 (diff) |
prevent rendering visible whitespace on trailing cursor (#2331)
-rw-r--r-- | helix-term/src/ui/editor.rs | 4 |
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 { |