aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--book/src/themes.md4
-rw-r--r--helix-term/src/ui/editor.rs20
2 files changed, 17 insertions, 7 deletions
diff --git a/book/src/themes.md b/book/src/themes.md
index 015ec59b..0d0827fd 100644
--- a/book/src/themes.md
+++ b/book/src/themes.md
@@ -252,10 +252,14 @@ These scopes are used for theming the editor interface.
| `ui.background` | |
| `ui.background.separator` | Picker separator below input line |
| `ui.cursor` | |
+| `ui.cursor.normal` | |
| `ui.cursor.insert` | |
| `ui.cursor.select` | |
| `ui.cursor.match` | Matching bracket etc. |
| `ui.cursor.primary` | Cursor with primary selection |
+| `ui.cursor.primary.normal` | |
+| `ui.cursor.primary.insert` | |
+| `ui.cursor.primary.select` | |
| `ui.gutter` | Gutter |
| `ui.gutter.selected` | Gutter for the line the cursor is on |
| `ui.linenr` | Line numbers |
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs
index 35cf77ab..a19eb213 100644
--- a/helix-term/src/ui/editor.rs
+++ b/helix-term/src/ui/editor.rs
@@ -342,23 +342,29 @@ impl EditorView {
let selection_scope = theme
.find_scope_index("ui.selection")
.expect("could not find `ui.selection` scope in the theme!");
+ let primary_selection_scope = theme
+ .find_scope_index("ui.selection.primary")
+ .unwrap_or(selection_scope);
let base_cursor_scope = theme
.find_scope_index("ui.cursor")
.unwrap_or(selection_scope);
+ let base_primary_cursor_scope = theme
+ .find_scope_index("ui.cursor.primary")
+ .unwrap_or(base_cursor_scope);
let cursor_scope = match mode {
Mode::Insert => theme.find_scope_index("ui.cursor.insert"),
Mode::Select => theme.find_scope_index("ui.cursor.select"),
- Mode::Normal => Some(base_cursor_scope),
+ Mode::Normal => theme.find_scope_index("ui.cursor.normal"),
}
.unwrap_or(base_cursor_scope);
- let primary_cursor_scope = theme
- .find_scope_index("ui.cursor.primary")
- .unwrap_or(cursor_scope);
- let primary_selection_scope = theme
- .find_scope_index("ui.selection.primary")
- .unwrap_or(selection_scope);
+ let primary_cursor_scope = match mode {
+ Mode::Insert => theme.find_scope_index("ui.cursor.primary.insert"),
+ Mode::Select => theme.find_scope_index("ui.cursor.primary.select"),
+ Mode::Normal => theme.find_scope_index("ui.cursor.primary.normal"),
+ }
+ .unwrap_or(base_primary_cursor_scope);
let mut spans: Vec<(usize, std::ops::Range<usize>)> = Vec::new();
for (i, range) in selection.iter().enumerate() {