From 5945815d978da07d0970502d481c17ef02525c4d Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Thu, 1 Oct 2020 18:44:12 +0900 Subject: Fix cursor rendering & placement on append mode. --- helix-term/src/editor.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'helix-term/src') diff --git a/helix-term/src/editor.rs b/helix-term/src/editor.rs index 23ecbea9..a3bc8b3b 100644 --- a/helix-term/src/editor.rs +++ b/helix-term/src/editor.rs @@ -127,7 +127,7 @@ impl Editor { .ranges() .iter() // TODO: limit selection to one in viewport - .filter(|range| !range.is_empty()) // && range.overlaps(&Range::new(start, end + 1)) + // .filter(|range| !range.is_empty()) // && range.overlaps(&Range::new(start, end + 1)) .copied() .collect(); @@ -178,6 +178,7 @@ impl Editor { let grapheme = Cow::from(grapheme); let width = grapheme_width(&grapheme) as u16; + // TODO: this should really happen as an after pass let style = if visible_selections .iter() .any(|range| range.contains(char_index)) @@ -188,6 +189,15 @@ impl Editor { style }; + let style = if visible_selections + .iter() + .any(|range| range.head == char_index) + { + style.clone().bg(Color::Rgb(255, 255, 255)) + } else { + style + }; + // TODO: paint cursor heads except primary self.surface.set_string( -- cgit v1.2.3-70-g09d2