Update status bar theming
Co-Authored-By: Nate Butler <iamnbutler@gmail.com>
This commit is contained in:
co-authored by
Nate Butler
parent
baa16a2fc6
commit
1f65effe57
@@ -402,7 +402,7 @@ pub struct StatusBar {
|
||||
pub height: f32,
|
||||
pub item_spacing: f32,
|
||||
pub cursor_position: TextStyle,
|
||||
pub vim_mode_indicator: TextStyle,
|
||||
pub vim_mode_indicator: ContainedText,
|
||||
pub active_language: Interactive<ContainedText>,
|
||||
pub auto_update_progress_message: TextStyle,
|
||||
pub auto_update_done_message: TextStyle,
|
||||
|
||||
@@ -33,6 +33,7 @@ search = { path = "../search" }
|
||||
settings = { path = "../settings" }
|
||||
workspace = { path = "../workspace" }
|
||||
theme = { path = "../theme" }
|
||||
language_selector = { path = "../language_selector"}
|
||||
|
||||
[dev-dependencies]
|
||||
indoc.workspace = true
|
||||
|
||||
@@ -40,7 +40,10 @@ impl View for ModeIndicator {
|
||||
Mode::Visual { line: false } => "-- VISUAL --",
|
||||
Mode::Visual { line: true } => "VISUAL LINE ",
|
||||
};
|
||||
Label::new(text, theme.vim_mode_indicator.clone()).into_any()
|
||||
Label::new(text, theme.vim_mode_indicator.text.clone())
|
||||
.contained()
|
||||
.with_style(theme.vim_mode_indicator.container)
|
||||
.into_any()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -289,9 +289,8 @@ impl Vim {
|
||||
Some(cx.add_view(|_| ModeIndicator::new(vim.state.mode)));
|
||||
};
|
||||
let mode_indicator = vim.mode_indicator.as_ref().unwrap();
|
||||
// TODO: would it be better to depend on the diagnostics crate
|
||||
// so we can pass the type directly?
|
||||
let position = status_bar.position_of_named_item("DiagnosticIndicator");
|
||||
let position = status_bar
|
||||
.position_of_item::<language_selector::ActiveBufferLanguage>();
|
||||
if let Some(position) = position {
|
||||
status_bar.insert_item_after(position, mode_indicator.clone(), cx)
|
||||
} else {
|
||||
|
||||
@@ -107,17 +107,13 @@ impl StatusBar {
|
||||
where
|
||||
T: StatusItemView,
|
||||
{
|
||||
self.position_of_named_item(T::ui_name())
|
||||
}
|
||||
|
||||
pub fn position_of_named_item(&self, name: &str) -> Option<usize> {
|
||||
for (index, item) in self.left_items.iter().enumerate() {
|
||||
if item.as_ref().ui_name() == name {
|
||||
if item.as_ref().ui_name() == T::ui_name() {
|
||||
return Some(index);
|
||||
}
|
||||
}
|
||||
for (index, item) in self.right_items.iter().enumerate() {
|
||||
if item.as_ref().ui_name() == name {
|
||||
if item.as_ref().ui_name() == T::ui_name() {
|
||||
return Some(index + self.left_items.len());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user