mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-22 09:26:19 +04:00
add spacer element to statusline (#3165)
* add spacer element to statusline * docs
This commit is contained in:
parent
742d16026e
commit
bfdcfec8c9
@ -78,6 +78,7 @@ ### `[editor.statusline]` Section
|
||||
| `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
|
||||
|
||||
|
@ -143,6 +143,7 @@ fn get_render_function<F>(element_id: StatusLineElementID) -> impl Fn(&mut Rende
|
||||
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 @@ fn render_file_name<F>(context: &mut RenderContext, write: F)
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user