From bfdcfec8c954225f79b49ce3e4db4bb76715ae69 Mon Sep 17 00:00:00 2001 From: Seth Bromberger Date: Tue, 26 Jul 2022 03:07:59 +0200 Subject: [PATCH] add spacer element to statusline (#3165) * add spacer element to statusline * docs --- book/src/configuration.md | 1 + helix-term/src/ui/statusline.rs | 8 ++++++++ helix-view/src/editor.rs | 3 +++ 3 files changed, 12 insertions(+) diff --git a/book/src/configuration.md b/book/src/configuration.md index 4eab4a48a..c9f435bf0 100644 --- a/book/src/configuration.md +++ b/book/src/configuration.md @@ -78,6 +78,7 @@ The following elements can be configured: | `diagnostics` | The number of warnings and/or errors | | `selections` | The number of active selections | | `position` | The cursor position | +| `spacer` | Inserts a space between elements (multiple/contiguous spacers may be specified) | ### `[editor.lsp]` Section diff --git a/helix-term/src/ui/statusline.rs b/helix-term/src/ui/statusline.rs index 85992c602..e9e478bff 100644 --- a/helix-term/src/ui/statusline.rs +++ b/helix-term/src/ui/statusline.rs @@ -143,6 +143,7 @@ where helix_view::editor::StatusLineElement::Diagnostics => render_diagnostics, helix_view::editor::StatusLineElement::Selections => render_selections, helix_view::editor::StatusLineElement::Position => render_position, + helix_view::editor::StatusLineElement::Spacer => render_spacer, } } @@ -334,3 +335,10 @@ where write(context, title, None); } + +fn render_spacer(context: &mut RenderContext, write: F) +where + F: Fn(&mut RenderContext, String, Option