From 04f52c3d502ae4ab2dffe6bc85082806dcdf4130 Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Fri, 17 Mar 2023 11:34:17 -0700 Subject: [PATCH] Show active buffer language in all cases --- .../src/active_buffer_language.rs | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/crates/language_selector/src/active_buffer_language.rs b/crates/language_selector/src/active_buffer_language.rs index 1da0b4323c..ce9fd5a3b0 100644 --- a/crates/language_selector/src/active_buffer_language.rs +++ b/crates/language_selector/src/active_buffer_language.rs @@ -50,21 +50,23 @@ impl View for ActiveBufferLanguage { } fn render(&mut self, cx: &mut RenderContext) -> ElementBox { - if let Some(active_language) = self.active_language.as_ref() { - MouseEventHandler::::new(0, cx, |state, cx| { - let theme = &cx.global::().theme.workspace.status_bar; - let style = theme.active_language.style_for(state, false); - Label::new(active_language.to_string(), style.text.clone()) - .contained() - .with_style(style.container) - .boxed() - }) - .with_cursor_style(CursorStyle::PointingHand) - .on_click(MouseButton::Left, |_, cx| cx.dispatch_action(crate::Toggle)) - .boxed() + let active_language = if let Some(active_language) = self.active_language.as_ref() { + active_language.to_string() } else { - Empty::new().boxed() - } + "Unkown".to_string() + }; + + MouseEventHandler::::new(0, cx, |state, cx| { + let theme = &cx.global::().theme.workspace.status_bar; + let style = theme.active_language.style_for(state, false); + Label::new(active_language, style.text.clone()) + .contained() + .with_style(style.container) + .boxed() + }) + .with_cursor_style(CursorStyle::PointingHand) + .on_click(MouseButton::Left, |_, cx| cx.dispatch_action(crate::Toggle)) + .boxed() } }