summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunrelentingtech2022-04-12 07:48:30 +0000
committerGitHub2022-04-12 07:48:30 +0000
commitd5c086697896d87f034c1dbe0ae0ccbc71f37d2c (patch)
treeff2898eee6696815090e987d22a33fbf3a8c7335
parentf3dcb4034fd528b620935780bcd5e86937c0b393 (diff)
Apply ui.gutter style to empty gutters (#2032)
The unstyled column on the left from the diagnostics_or_breakpoints gutter looks sad if you want to add a background to all gutters. Let's fix this.
-rw-r--r--helix-term/src/ui/editor.rs18
1 files changed, 12 insertions, 6 deletions
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs
index 979b95d9..564605de 100644
--- a/helix-term/src/ui/editor.rs
+++ b/helix-term/src/ui/editor.rs
@@ -471,14 +471,20 @@ impl EditorView {
text.reserve(*width); // ensure there's enough space for the gutter
for (i, line) in (view.offset.row..(last_line + 1)).enumerate() {
let selected = cursors.contains(&line);
+ let x = viewport.x + offset;
+ let y = viewport.y + i as u16;
if let Some(style) = gutter(line, selected, &mut text) {
- surface.set_stringn(
- viewport.x + offset,
- viewport.y + i as u16,
- &text,
- *width,
- gutter_style.patch(style),
+ surface.set_stringn(x, y, &text, *width, gutter_style.patch(style));
+ } else {
+ surface.set_style(
+ Rect {
+ x,
+ y,
+ width: *width as u16,
+ height: 1,
+ },
+ gutter_style,
);
}
text.clear();