From c9ed42cdec95b67b0d0ed15218daff37358ca86f Mon Sep 17 00:00:00 2001 From: Nick Date: Sat, 31 Dec 2022 19:48:14 +0530 Subject: Add a status line element that shows just the basename of the file (#5318) --- helix-term/src/ui/statusline.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'helix-term/src/ui/statusline.rs') diff --git a/helix-term/src/ui/statusline.rs b/helix-term/src/ui/statusline.rs index 501faea3..a25b4540 100644 --- a/helix-term/src/ui/statusline.rs +++ b/helix-term/src/ui/statusline.rs @@ -139,6 +139,7 @@ where match element_id { helix_view::editor::StatusLineElement::Mode => render_mode, helix_view::editor::StatusLineElement::Spinner => render_lsp_spinner, + helix_view::editor::StatusLineElement::FileBaseName => render_file_base_name, helix_view::editor::StatusLineElement::FileName => render_file_name, helix_view::editor::StatusLineElement::FileEncoding => render_file_encoding, helix_view::editor::StatusLineElement::FileLineEnding => render_file_line_ending, @@ -426,6 +427,26 @@ where write(context, title, None); } +fn render_file_base_name(context: &mut RenderContext, write: F) +where + F: Fn(&mut RenderContext, String, Option