Skip to content

Commit 8f99400

Browse files
ChrHornpathwave
authored andcommitted
Add ui.gutter.selected option for themes (helix-editor#3303)
* add `ui.gutter.selected` * add `ui.gutter`, `ui.gutter.selected` to docs
1 parent 24ea1f7 commit 8f99400

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

book/src/themes.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,7 @@ impl EditorView {
745745
let mut offset = 0;
746746

747747
let gutter_style = theme.get("ui.gutter");
748+
let gutter_selected_style = theme.get("ui.gutter.selected");
748749

749750
// avoid lots of small allocations by reusing a text buffer for each line
750751
let mut text = String::with_capacity(8);
@@ -757,6 +758,12 @@ impl EditorView {
757758
let x = viewport.x + offset;
758759
let y = viewport.y + i as u16;
759760

761+
let gutter_style = if selected {
762+
gutter_selected_style
763+
} else {
764+
gutter_style
765+
};
766+
760767
if let Some(style) = gutter(line, selected, &mut text) {
761768
surface.set_stringn(x, y, &text, *width, gutter_style.patch(style));
762769
} else {

0 commit comments

Comments
 (0)