add spacer element to statusline (#3165)

* add spacer element to statusline

* docs
This commit is contained in:
Seth Bromberger 2022-07-26 03:07:59 +02:00 committed by GitHub
parent 742d16026e
commit bfdcfec8c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 0 deletions

View file

@ -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

View file

@ -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<F>(context: &mut RenderContext, write: F)
where
F: Fn(&mut RenderContext, String, Option<Style>) + Copy,
{
write(context, String::from(" "), None);
}

View file

@ -246,6 +246,9 @@ pub enum StatusLineElement {
/// The cursor position
Position,
/// A single space
Spacer,
}
// Cursor shape is read and used on every rendered frame and so needs