Show active buffer language in all cases
This commit is contained in:
parent
1125a168f4
commit
04f52c3d50
1 changed files with 16 additions and 14 deletions
|
@ -50,11 +50,16 @@ impl View for ActiveBufferLanguage {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, cx: &mut RenderContext<Self>) -> ElementBox {
|
fn render(&mut self, cx: &mut RenderContext<Self>) -> ElementBox {
|
||||||
if let Some(active_language) = self.active_language.as_ref() {
|
let active_language = if let Some(active_language) = self.active_language.as_ref() {
|
||||||
|
active_language.to_string()
|
||||||
|
} else {
|
||||||
|
"Unkown".to_string()
|
||||||
|
};
|
||||||
|
|
||||||
MouseEventHandler::<Self>::new(0, cx, |state, cx| {
|
MouseEventHandler::<Self>::new(0, cx, |state, cx| {
|
||||||
let theme = &cx.global::<Settings>().theme.workspace.status_bar;
|
let theme = &cx.global::<Settings>().theme.workspace.status_bar;
|
||||||
let style = theme.active_language.style_for(state, false);
|
let style = theme.active_language.style_for(state, false);
|
||||||
Label::new(active_language.to_string(), style.text.clone())
|
Label::new(active_language, style.text.clone())
|
||||||
.contained()
|
.contained()
|
||||||
.with_style(style.container)
|
.with_style(style.container)
|
||||||
.boxed()
|
.boxed()
|
||||||
|
@ -62,9 +67,6 @@ impl View for ActiveBufferLanguage {
|
||||||
.with_cursor_style(CursorStyle::PointingHand)
|
.with_cursor_style(CursorStyle::PointingHand)
|
||||||
.on_click(MouseButton::Left, |_, cx| cx.dispatch_action(crate::Toggle))
|
.on_click(MouseButton::Left, |_, cx| cx.dispatch_action(crate::Toggle))
|
||||||
.boxed()
|
.boxed()
|
||||||
} else {
|
|
||||||
Empty::new().boxed()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue