on master help sign in
add spacer element to statusline (#3165)

* add spacer element to statusline * docs

commitbfdcfec8c954225f79b49ce3e4db4bb76715ae69 authorSeth Bromberger <sbromberger@users.noreply.github.com> dateTue 26 Jul 2022, 03:07 (4 years ago) parent742d160
3 files changed+12
book/src/configuration.md+1 helix-term/src/ui/statusline.rs+8 helix-view/src/editor.rs+3
book/src/configuration.md+1
@@ -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+8
@@ -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+3
@@ -246,6 +246,9 @@ pub enum StatusLineElement {
246246
247247 /// The cursor position
248248 Position,
249+
250+ /// A single space
251+ Spacer,
249252}
250253
251254// Cursor shape is read and used on every rendered frame and so needs