Skip to content

Commit

Permalink
prevent substitution of trailing cursor
Browse files Browse the repository at this point in the history
  • Loading branch information
the-mikedavis committed Mar 13, 2022
1 parent b6332a7 commit 45fd800
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions helix-term/src/ui/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,8 @@ impl EditorView {
// `unwrap_or_else` part is for off-the-end indices of
// the rope, to allow cursor highlighting at the end
// of the rope.
let is_trailing_cursor = text.len_chars() < end;

let text = text.get_slice(start..end).unwrap_or_else(|| " ".into());

use helix_core::graphemes::{grapheme_width, RopeGraphemes};
Expand Down Expand Up @@ -410,6 +412,7 @@ impl EditorView {
(&tab[..grapheme_tab_width], visual_tab_width)
} else if whitespace.render.space() == WhitespaceRenderValue::All
&& grapheme == " "
&& !is_trailing_cursor
{
is_whitespace = true;
(whitespace.substitutions.space.as_ref(), 1)
Expand Down

0 comments on commit 45fd800

Please sign in to comment.