diff options
author | gibbz00 | 2023-01-18 05:18:49 +0000 |
---|---|---|
committer | GitHub | 2023-01-18 05:18:49 +0000 |
commit | deae13f404fadddf16f7c2005af8b383a1d8e362 (patch) | |
tree | cd9820dbae7ad24651051969be09e484917e8cb6 /helix-term/src | |
parent | b65f104a3fe1d8bdd0dbf901f7c52576b2b5f1c0 (diff) |
Primary cursor colors by mode (#5130)
* (theme) feat: mode based primary cursor colors
* docs/themes: mode based primary cursor colors
Diffstat (limited to 'helix-term/src')
-rw-r--r-- | helix-term/src/ui/editor.rs | 20 |
1 files changed, 13 insertions, 7 deletions
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() { |