on master help sign in
add spacer element to statusline (#3165)
bfdcfecSeth Bromberger
book/src/configuration.md+1
@@ -78,6 +78,7 @@ The following elements can be configured:
78| `diagnostics` | The number of warnings and/or errors |
78| `diagnostics` | The number of warnings and/or errors |
79| `selections` | The number of active selections |
79| `selections` | The number of active selections |
80| `position` | The cursor position |
80| `position` | The cursor position |
81+| `spacer` | Inserts a space between elements (multiple/contiguous spacers may be specified) |
81
82
82### `[editor.lsp]` Section
83### `[editor.lsp]` Section
83
84
helix-term/src/ui/statusline.rs+8
@@ -143,6 +143,7 @@ where
143 helix_view::editor::StatusLineElement::Diagnostics => render_diagnostics,
143 helix_view::editor::StatusLineElement::Diagnostics => render_diagnostics,
144 helix_view::editor::StatusLineElement::Selections => render_selections,
144 helix_view::editor::StatusLineElement::Selections => render_selections,
145 helix_view::editor::StatusLineElement::Position => render_position,
145 helix_view::editor::StatusLineElement::Position => render_position,
146+ helix_view::editor::StatusLineElement::Spacer => render_spacer,
146 }
147 }
147}
148}
148
149
@@ -334,3 +335,10 @@ where
334
335
335 write(context, title, None);
336 write(context, title, None);
336}
337}
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+3
@@ -246,6 +246,9 @@ pub enum StatusLineElement {
246
246
247 /// The cursor position
247 /// The cursor position
248 Position,
248 Position,
249+
250+ /// A single space
251+ Spacer,
249}
252}
250
253
251// Cursor shape is read and used on every rendered frame and so needs
254// Cursor shape is read and used on every rendered frame and so needs