diff options
author | Blaž Hrastnik | 2020-10-01 09:44:12 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2020-10-01 09:44:12 +0000 |
commit | 5945815d978da07d0970502d481c17ef02525c4d (patch) | |
tree | db8e77f9aef2d14977588d73d71319822c5ef7ff /helix-term | |
parent | d9d59cd209c9cbd1397ed4d05b1d14a6aad514bf (diff) |
Fix cursor rendering & placement on append mode.
Diffstat (limited to 'helix-term')
-rw-r--r-- | helix-term/src/editor.rs | 12 |
1 files changed, 11 insertions, 1 deletions
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( |