on master help sign in
Add `ui.gutter.selected` option for themes (#3303)

* add `ui.gutter.selected` * add `ui.gutter`, `ui.gutter.selected` to docs

commit589d17c7583716b339875b72972aaffe0ae5efc1 authorChrHorn <christoph-horn@hotmail.de> dateMon 3 Oct 2022, 16:44 (4 years ago) parent6939dd3
2 files changed+9
book/src/themes.md+2 helix-term/src/ui/editor.rs+7
book/src/themes.md+2
@@ -219,6 +219,8 @@ These scopes are used for theming the editor interface.
219219| `ui.cursor.select` | |
220220| `ui.cursor.match` | Matching bracket etc. |
221221| `ui.cursor.primary` | Cursor with primary selection |
222+| `ui.gutter` | Gutter |
223+| `ui.gutter.selected` | Gutter for the line the cursor is on |
222224| `ui.linenr` | Line numbers |
223225| `ui.linenr.selected` | Line number for the line the cursor is on |
224226| `ui.statusline` | Statusline |
helix-term/src/ui/editor.rs+7
@@ -696,6 +696,7 @@ impl EditorView {
696696 let mut offset = 0;
697697
698698 let gutter_style = theme.get("ui.gutter");
699+ let gutter_selected_style = theme.get("ui.gutter.selected");
699700
700701 // avoid lots of small allocations by reusing a text buffer for each line
701702 let mut text = String::with_capacity(8);
@@ -708,6 +709,12 @@ impl EditorView {
708709 let x = viewport.x + offset;
709710 let y = viewport.y + i as u16;
710711
712+ let gutter_style = if selected {
713+ gutter_selected_style
714+ } else {
715+ gutter_style
716+ };
717+
711718 if let Some(style) = gutter(line, selected, &mut text) {
712719 surface.set_stringn(x, y, &text, *width, gutter_style.patch(style));
713720 } else {