diff options
author | Gokul Soumya | 2021-11-24 06:47:41 +0000 |
---|---|---|
committer | Gokul Soumya | 2021-11-24 06:56:49 +0000 |
commit | 7961355ba1c0cd521372496c507a31a51b41ddf2 (patch) | |
tree | 7aa64278562ac9215d422de66747291eedf1046b /helix-term | |
parent | 21143e8d22c13ead8c1835063acb518aa5a42822 (diff) |
Change cursor shape on mode change
Fixes #323. Due to terminal limitations we can only
change the shape of the primary cursor.
Diffstat (limited to 'helix-term')
-rw-r--r-- | helix-term/src/ui/editor.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index 27d33d22..8ad54dbd 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -250,7 +250,9 @@ impl EditorView { // Special-case: cursor at end of the rope. if range.head == range.anchor && range.head == text.len_chars() { - spans.push((cursor_scope, range.head..range.head + 1)); + if i != primary_idx { + spans.push((cursor_scope, range.head..range.head + 1)); + } continue; } @@ -259,11 +261,15 @@ impl EditorView { // Standard case. let cursor_start = prev_grapheme_boundary(text, range.head); spans.push((selection_scope, range.anchor..cursor_start)); - spans.push((cursor_scope, cursor_start..range.head)); + if i != primary_idx { + spans.push((cursor_scope, cursor_start..range.head)); + } } else { // Reverse case. let cursor_end = next_grapheme_boundary(text, range.head); - spans.push((cursor_scope, range.head..cursor_end)); + if i != primary_idx { + spans.push((cursor_scope, range.head..cursor_end)); + } spans.push((selection_scope, cursor_end..range.anchor)); } } |