Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 3c50f91
Author: usagi-flow <[email protected]>
Date:   Fri Oct 21 22:52:20 2022 +0200

    feat(statusline): if color_modes is enabled, color the file type as well
  • Loading branch information
usagi-flow committed May 18, 2024
1 parent dd990ca commit 5503542
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion helix-term/src/ui/statusline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,21 @@ where
F: Fn(&mut RenderContext, String, Option<Style>) + Copy,
{
let file_type = context.doc.language_name().unwrap_or(DEFAULT_LANGUAGE_NAME);
let visible = context.focused;

write(context, format!(" {} ", file_type), None);
write(
context,
format!(" {} ", file_type),
if visible && context.editor.config().color_modes {
match context.editor.mode() {
Mode::Insert => Some(context.editor.theme.get("ui.statusline.insert")),
Mode::Select => Some(context.editor.theme.get("ui.statusline.select")),
Mode::Normal => Some(context.editor.theme.get("ui.statusline.normal")),
}
} else {
None
},
);
}

fn render_file_name<F>(context: &mut RenderContext, write: F)
Expand Down

0 comments on commit 5503542

Please sign in to comment.