Skip to content

Commit 589d17c

Browse files
authored
Add ui.gutter.selected option for themes (#3303)
* add `ui.gutter.selected` * add `ui.gutter`, `ui.gutter.selected` to docs
1 parent 6939dd3 commit 589d17c

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
@@ -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 {

0 commit comments

Comments
 (0)