aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeth Bromberger2022-07-26 01:07:59 +0000
committerGitHub2022-07-26 01:07:59 +0000
commitbfdcfec8c954225f79b49ce3e4db4bb76715ae69 (patch)
tree7c0f58f3ba807a0fc02112b52b239af6a48cd408
parent742d16026eb288b93e334a92863bb46ec2b500e7 (diff)
add spacer element to statusline (#3165)
* add spacer element to statusline * docs
-rw-r--r--book/src/configuration.md1
-rw-r--r--helix-term/src/ui/statusline.rs8
-rw-r--r--helix-view/src/editor.rs3
3 files changed, 12 insertions, 0 deletions
diff --git a/book/src/configuration.md b/book/src/configuration.md
index 4eab4a48..c9f435bf 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 85992c60..e9e478bf 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<F>(context: &mut RenderContext, write: F)
+where
+ F: Fn(&mut RenderContext, String, Option<Style>) + Copy,
+{
+ write(context, String::from(" "), None);
+}
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs
index 7bfeb8db..53c664b1 100644
--- a/helix-view/src/editor.rs
+++ b/helix-view/src/editor.rs
@@ -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