mirror of https://github.com/helix-editor/helix
feat: statusline elements theme support
parent
2773bb0fa7
commit
738bdb429d
|
@ -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]) |
|
||||
|
|
|
@ -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()
|
||||
|
@ -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());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue