Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-term/src/ui/statusline.rs')
| -rw-r--r-- | helix-term/src/ui/statusline.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/helix-term/src/ui/statusline.rs b/helix-term/src/ui/statusline.rs index df23123c..ea3d27bd 100644 --- a/helix-term/src/ui/statusline.rs +++ b/helix-term/src/ui/statusline.rs @@ -1,5 +1,6 @@ use std::borrow::Cow; +use helix_core::indent::IndentStyle; use helix_core::{coords_at_pos, encoding, Position}; use helix_lsp::lsp::DiagnosticSeverity; use helix_view::document::DEFAULT_LANGUAGE_NAME; @@ -142,6 +143,7 @@ where helix_view::editor::StatusLineElement::ReadOnlyIndicator => render_read_only_indicator, helix_view::editor::StatusLineElement::FileEncoding => render_file_encoding, helix_view::editor::StatusLineElement::FileLineEnding => render_file_line_ending, + helix_view::editor::StatusLineElement::FileIndentStyle => render_file_indent_style, helix_view::editor::StatusLineElement::FileType => render_file_type, helix_view::editor::StatusLineElement::Diagnostics => render_diagnostics, helix_view::editor::StatusLineElement::WorkspaceDiagnostics => render_workspace_diagnostics, @@ -554,3 +556,20 @@ where write(context, format!(" reg={} ", reg).into()) } } + +fn render_file_indent_style<'a, F>(context: &mut RenderContext<'a>, write: F) +where + F: Fn(&mut RenderContext<'a>, Span<'a>) + Copy, +{ + let style = context.doc.indent_style; + + write( + context, + match style { + IndentStyle::Tabs => " tabs ".into(), + IndentStyle::Spaces(indent) => { + format!(" {} space{} ", indent, if indent == 1 { "" } else { "s" }).into() + } + }, + ); +} |