on master help sign in
Add `ui.gutter.selected` option for themes (#3303)
589d17cChrHorn
book/src/themes.md+2
@@ -219,6 +219,8 @@ These scopes are used for theming the editor interface.
219| `ui.cursor.select` | |
219| `ui.cursor.select` | |
220| `ui.cursor.match` | Matching bracket etc. |
220| `ui.cursor.match` | Matching bracket etc. |
221| `ui.cursor.primary` | Cursor with primary selection |
221| `ui.cursor.primary` | Cursor with primary selection |
222+| `ui.gutter` | Gutter |
223+| `ui.gutter.selected` | Gutter for the line the cursor is on |
222| `ui.linenr` | Line numbers |
224| `ui.linenr` | Line numbers |
223| `ui.linenr.selected` | Line number for the line the cursor is on |
225| `ui.linenr.selected` | Line number for the line the cursor is on |
224| `ui.statusline` | Statusline |
226| `ui.statusline` | Statusline |
helix-term/src/ui/editor.rs+7
@@ -696,6 +696,7 @@ impl EditorView {
696 let mut offset = 0;
696 let mut offset = 0;
697
697
698 let gutter_style = theme.get("ui.gutter");
698 let gutter_style = theme.get("ui.gutter");
699+ let gutter_selected_style = theme.get("ui.gutter.selected");
699
700
700 // avoid lots of small allocations by reusing a text buffer for each line
701 // avoid lots of small allocations by reusing a text buffer for each line
701 let mut text = String::with_capacity(8);
702 let mut text = String::with_capacity(8);
@@ -708,6 +709,12 @@ impl EditorView {
708 let x = viewport.x + offset;
709 let x = viewport.x + offset;
709 let y = viewport.y + i as u16;
710 let y = viewport.y + i as u16;
710
711
712+ let gutter_style = if selected {
713+ gutter_selected_style
714+ } else {
715+ gutter_style
716+ };
717+
711 if let Some(style) = gutter(line, selected, &mut text) {
718 if let Some(style) = gutter(line, selected, &mut text) {
712 surface.set_stringn(x, y, &text, *width, gutter_style.patch(style));
719 surface.set_stringn(x, y, &text, *width, gutter_style.patch(style));
713 } else {
720 } else {