Skip to content

Commit

Permalink
prevent rendering visible whitespace on trailing cursor (#2331)
Browse files Browse the repository at this point in the history
  • Loading branch information
the-mikedavis authored Apr 30, 2022
1 parent 2687b8f commit e4c2618
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion helix-term/src/ui/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 {
Expand Down

0 comments on commit e4c2618

Please sign in to comment.