Skip to content

Commit bdf1d3d

Browse files
sbrombergerthomasskk
authored andcommitted
add spacer element to statusline (helix-editor#3165)
* add spacer element to statusline * docs
1 parent 48ddf44 commit bdf1d3d

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

book/src/configuration.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ The following elements can be configured:
7878
| `diagnostics` | The number of warnings and/or errors |
7979
| `selections` | The number of active selections |
8080
| `position` | The cursor position |
81+
| `spacer` | Inserts a space between elements (multiple/contiguous spacers may be specified) |
8182

8283
### `[editor.lsp]` Section
8384

helix-term/src/ui/statusline.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ where
143143
helix_view::editor::StatusLineElement::Diagnostics => render_diagnostics,
144144
helix_view::editor::StatusLineElement::Selections => render_selections,
145145
helix_view::editor::StatusLineElement::Position => render_position,
146+
helix_view::editor::StatusLineElement::Spacer => render_spacer,
146147
}
147148
}
148149

@@ -334,3 +335,10 @@ where
334335

335336
write(context, title, None);
336337
}
338+
339+
fn render_spacer<F>(context: &mut RenderContext, write: F)
340+
where
341+
F: Fn(&mut RenderContext, String, Option<Style>) + Copy,
342+
{
343+
write(context, String::from(" "), None);
344+
}

helix-view/src/editor.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,9 @@ pub enum StatusLineElement {
311311

312312
/// The cursor position
313313
Position,
314+
315+
/// A single space
316+
Spacer,
314317
}
315318

316319
// Cursor shape is read and used on every rendered frame and so needs

0 commit comments

Comments
 (0)