From ea3293b4daaa472c363105e3c2c2666a2af82ffc Mon Sep 17 00:00:00 2001 From: Colton Clemmer Date: Fri, 10 Feb 2023 11:34:18 -0600 Subject: [PATCH] Split modification indicator from file statusline elements (#4731) --- helix-term/src/ui/statusline.rs | 29 +++++++++++++++++++---------- helix-view/src/editor.rs | 10 +++++++++- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/helix-term/src/ui/statusline.rs b/helix-term/src/ui/statusline.rs index a25b4540d..dbb513f8d 100644 --- a/helix-term/src/ui/statusline.rs +++ b/helix-term/src/ui/statusline.rs @@ -141,6 +141,9 @@ where 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::FileModificationIndicator => { + render_file_modification_indicator + } helix_view::editor::StatusLineElement::FileEncoding => render_file_encoding, helix_view::editor::StatusLineElement::FileLineEnding => render_file_line_ending, helix_view::editor::StatusLineElement::FileType => render_file_type, @@ -417,16 +420,26 @@ where .as_ref() .map(|p| p.to_string_lossy()) .unwrap_or_else(|| SCRATCH_BUFFER_NAME.into()); - format!( - " {}{} ", - path, - if context.doc.is_modified() { "[+]" } else { "" } - ) + format!(" {} ", path) }; write(context, title, None); } +fn render_file_modification_indicator(context: &mut RenderContext, write: F) +where + F: Fn(&mut RenderContext, String, Option