diff --git a/book/src/themes.md b/book/src/themes.md index dc377db17..31ac36a59 100644 --- a/book/src/themes.md +++ b/book/src/themes.md @@ -285,7 +285,7 @@ These scopes are used for theming the editor interface: | `ui.gutter.selected` | Gutter for the line the cursor is on | | `ui.linenr` | Line numbers | | `ui.linenr.selected` | Line number for the line the cursor is on | -| `ui.statusline` | Statusline | +| `ui.statusline` | Statusline (support element style e.g. `ui.statusline.file-name`) | | `ui.statusline.inactive` | Statusline (unfocused document) | | `ui.statusline.normal` | Statusline mode during normal mode ([only if `editor.color-modes` is enabled][editor-section]) | | `ui.statusline.insert` | Statusline mode during insert mode ([only if `editor.color-modes` is enabled][editor-section]) | diff --git a/helix-term/src/ui/statusline.rs b/helix-term/src/ui/statusline.rs index 9f7099329..f08179ab6 100644 --- a/helix-term/src/ui/statusline.rs +++ b/helix-term/src/ui/statusline.rs @@ -165,11 +165,15 @@ where } fn statusline_style(context: &RenderContext, scope: &str) -> Style { - let scope = format!("ui.statusline.{scope}"); - let visible = context.focused; + let scope = if context.focused { + format!("ui.statusline.{scope}") + } else { + format!("ui.statusline.inactive.{scope}") + }; + let config = context.editor.config(); - if visible && config.color_modes { + if config.color_modes { context.editor.theme.get(&scope) } else { Style::default() @@ -411,7 +415,7 @@ where let maxrows = context.doc.text().len_lines(); write( context, - format!("{}%", (position.row + 1) * 100 / maxrows).into(), + format!(" {}% ", (position.row + 1) * 100 / maxrows).into(), ); } @@ -496,11 +500,7 @@ fn render_file_modification_indicator<'a, F>(context: &mut RenderContext<'a>, wr where F: Fn(&mut RenderContext<'a>, Span<'a>) + Copy, { - let title = if context.doc.is_modified() { - "[+]" - } else { - " " - }; + let title = if context.doc.is_modified() { "[+]" } else { "" }; write(context, title.into()); }