Fix label color for inactive tabs (#3899)

This PR fixes an issue where certain tabs were not using the correct
color for their labels when they were inactive.

Release Notes:

- Fixed an issue where some inactive tabs were not using the correct
label color.
This commit is contained in:
Marshall Bowers 2024-01-04 17:25:11 -05:00 committed by GitHub
parent 32cd4d778a
commit 47476faef1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 7 deletions

View file

@ -641,8 +641,13 @@ impl Item for ProjectDiagnosticsEditor {
fn tab_content(&self, _detail: Option<usize>, selected: bool, _: &WindowContext) -> AnyElement {
if self.summary.error_count == 0 && self.summary.warning_count == 0 {
let label = Label::new("No problems");
label.into_any_element()
Label::new("No problems")
.color(if selected {
Color::Default
} else {
Color::Muted
})
.into_any_element()
} else {
h_stack()
.gap_1()

View file

@ -10,7 +10,7 @@ use language::{LanguageServerId, LanguageServerName};
use lsp::IoKind;
use project::{search::SearchQuery, Project};
use std::{borrow::Cow, sync::Arc};
use ui::{h_stack, popover_menu, Button, Checkbox, Clickable, ContextMenu, Label, Selection};
use ui::{popover_menu, prelude::*, Button, Checkbox, ContextMenu, Label, Selection};
use workspace::{
item::{Item, ItemHandle},
searchable::{SearchEvent, SearchableItem, SearchableItemHandle},
@ -614,8 +614,14 @@ impl Item for LspLogView {
Editor::to_item_events(event, f)
}
fn tab_content(&self, _: Option<usize>, _: bool, _: &WindowContext<'_>) -> AnyElement {
Label::new("LSP Logs").into_any_element()
fn tab_content(&self, _: Option<usize>, selected: bool, _: &WindowContext<'_>) -> AnyElement {
Label::new("LSP Logs")
.color(if selected {
Color::Default
} else {
Color::Muted
})
.into_any_element()
}
fn as_searchable(&self, handle: &View<Self>) -> Option<Box<dyn SearchableItemHandle>> {

View file

@ -405,8 +405,14 @@ impl Item for SyntaxTreeView {
fn to_item_events(_: &Self::Event, _: impl FnMut(workspace::item::ItemEvent)) {}
fn tab_content(&self, _: Option<usize>, _: bool, _: &WindowContext<'_>) -> AnyElement {
Label::new("Syntax Tree").into_any_element()
fn tab_content(&self, _: Option<usize>, selected: bool, _: &WindowContext<'_>) -> AnyElement {
Label::new("Syntax Tree")
.color(if selected {
Color::Default
} else {
Color::Muted
})
.into_any_element()
}
fn clone_on_split(