summaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorDimitar Gyurov2023-03-10 22:42:42 +0000
committerGitHub2023-03-10 22:42:42 +0000
commit1661e4b5e1d8ebfef28f798fcb86ba2656373ba0 (patch)
tree1c3d36d81a8fe5fafd66b6b61bc5253883ed1516 /helix-term
parent98415f288ffa043520b0c85bc4464dc44b85f948 (diff)
Add a version-control statusline element (#5682)
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/ui/statusline.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/helix-term/src/ui/statusline.rs b/helix-term/src/ui/statusline.rs
index 3e7065b8..88786351 100644
--- a/helix-term/src/ui/statusline.rs
+++ b/helix-term/src/ui/statusline.rs
@@ -159,6 +159,7 @@ where
helix_view::editor::StatusLineElement::TotalLineNumbers => render_total_line_numbers,
helix_view::editor::StatusLineElement::Separator => render_separator,
helix_view::editor::StatusLineElement::Spacer => render_spacer,
+ helix_view::editor::StatusLineElement::VersionControl => render_version_control,
}
}
@@ -476,3 +477,16 @@ where
{
write(context, String::from(" "), None);
}
+
+fn render_version_control<F>(context: &mut RenderContext, write: F)
+where
+ F: Fn(&mut RenderContext, String, Option<Style>) + Copy,
+{
+ let head = context
+ .doc
+ .version_control_head()
+ .unwrap_or_default()
+ .to_string();
+
+ write(context, head, None);
+}