This commit is contained in:
zumbalogy 2025-08-27 00:41:03 +08:00 committed by GitHub
commit 0ebc295c09
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 37 additions and 24 deletions

View file

@ -787,7 +787,8 @@ impl Render for ActivityIndicator {
}; };
let this = cx.entity().downgrade(); let this = cx.entity().downgrade();
let truncate_content = content.message.len() > MAX_MESSAGE_LEN; let truncate_content = content.message.len() > MAX_MESSAGE_LEN;
result.gap_2().child( let spaced_result = result.gap_2().py(DynamicSpacing::Base04.rems(cx));
spaced_result.child(
PopoverMenu::new("activity-indicator-popover") PopoverMenu::new("activity-indicator-popover")
.trigger( .trigger(
ButtonLike::new("activity-indicator-trigger").child( ButtonLike::new("activity-indicator-trigger").child(

View file

@ -94,6 +94,7 @@ impl Render for DiagnosticIndicator {
}; };
indicator indicator
.py(DynamicSpacing::Base04.rems(cx))
.child( .child(
ButtonLike::new("diagnostic-indicator") ButtonLike::new("diagnostic-indicator")
.child(diagnostic_indicator) .child(diagnostic_indicator)

View file

@ -76,6 +76,8 @@ impl Render for EditPredictionButton {
let all_language_settings = all_language_settings(None, cx); let all_language_settings = all_language_settings(None, cx);
let spaced_div = div().py(DynamicSpacing::Base04.rems(cx));
match all_language_settings.edit_predictions.provider { match all_language_settings.edit_predictions.provider {
EditPredictionProvider::None => div(), EditPredictionProvider::None => div(),
@ -100,7 +102,7 @@ impl Render for EditPredictionButton {
}; };
if let Status::Error(e) = status { if let Status::Error(e) = status {
return div().child( return spaced_div.child(
IconButton::new("copilot-error", icon) IconButton::new("copilot-error", icon)
.icon_size(IconSize::Small) .icon_size(IconSize::Small)
.on_click(cx.listener(move |_, _, window, cx| { .on_click(cx.listener(move |_, _, window, cx| {
@ -129,7 +131,7 @@ impl Render for EditPredictionButton {
} }
let this = cx.entity(); let this = cx.entity();
div().child( spaced_div.child(
PopoverMenu::new("copilot") PopoverMenu::new("copilot")
.menu(move |window, cx| { .menu(move |window, cx| {
Some(match status { Some(match status {
@ -185,7 +187,7 @@ impl Render for EditPredictionButton {
let this = cx.entity(); let this = cx.entity();
let fs = self.fs.clone(); let fs = self.fs.clone();
div().child( spaced_div.child(
PopoverMenu::new("supermaven") PopoverMenu::new("supermaven")
.menu(move |window, cx| match &status { .menu(move |window, cx| match &status {
SupermavenButtonStatus::NeedsActivation(activate_url) => { SupermavenButtonStatus::NeedsActivation(activate_url) => {
@ -249,7 +251,7 @@ impl Render for EditPredictionButton {
"Sign In" "Sign In"
}; };
return div().child( return spaced_div.child(
IconButton::new("zed-predict-pending-button", zeta_icon) IconButton::new("zed-predict-pending-button", zeta_icon)
.shape(IconButtonShape::Square) .shape(IconButtonShape::Square)
.indicator(Indicator::dot().color(Color::Muted)) .indicator(Indicator::dot().color(Color::Muted))
@ -355,7 +357,7 @@ impl Render for EditPredictionButton {
popover_menu = popover_menu.trigger(icon_button); popover_menu = popover_menu.trigger(icon_button);
} }
div().child(popover_menu.into_any_element()) spaced_div.child(popover_menu.into_any_element())
} }
} }
} }

View file

@ -1,13 +1,13 @@
use editor::{Editor, EditorSettings, MultiBufferSnapshot}; use editor::{Editor, EditorSettings, MultiBufferSnapshot};
use gpui::{App, Entity, FocusHandle, Focusable, Subscription, Task, WeakEntity}; use gpui::{App, Entity, FocusHandle, Focusable, Styled, Subscription, Task, WeakEntity};
use schemars::JsonSchema; use schemars::JsonSchema;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use settings::{Settings, SettingsSources}; use settings::{Settings, SettingsSources};
use std::{fmt::Write, num::NonZeroU32, time::Duration}; use std::{fmt::Write, num::NonZeroU32, time::Duration};
use text::{Point, Selection}; use text::{Point, Selection};
use ui::{ use ui::{
Button, ButtonCommon, Clickable, Context, FluentBuilder, IntoElement, LabelSize, ParentElement, Button, ButtonCommon, Clickable, Context, DynamicSpacing, FluentBuilder, IntoElement,
Render, Tooltip, Window, div, LabelSize, ParentElement, Render, Tooltip, Window, div,
}; };
use util::paths::FILE_ROW_COLUMN_DELIMITER; use util::paths::FILE_ROW_COLUMN_DELIMITER;
use workspace::{StatusItemView, Workspace, item::ItemHandle}; use workspace::{StatusItemView, Workspace, item::ItemHandle};
@ -223,7 +223,7 @@ impl Render for CursorPosition {
let context = self.context.clone(); let context = self.context.clone();
el.child( el.py(DynamicSpacing::Base04.rems(cx)).child(
Button::new("go-to-line-column", text) Button::new("go-to-line-column", text)
.label_size(LabelSize::Small) .label_size(LabelSize::Small)
.on_click(cx.listener(|this, _, window, cx| { .on_click(cx.listener(|this, _, window, cx| {

View file

@ -77,7 +77,7 @@ impl Render for ImageInfo {
.to_string(), .to_string(),
); );
div().child( div().py(DynamicSpacing::Base04.rems(cx)).child(
Button::new("image-metadata", components.join("")).label_size(LabelSize::Small), Button::new("image-metadata", components.join("")).label_size(LabelSize::Small),
) )
} }

View file

@ -1,10 +1,11 @@
use editor::{Editor, EditorSettings}; use editor::{Editor, EditorSettings};
use gpui::{ use gpui::{
Context, Entity, IntoElement, ParentElement, Render, Subscription, WeakEntity, Window, div, Context, Entity, IntoElement, ParentElement, Render, Styled, Subscription, WeakEntity, Window,
div,
}; };
use language::LanguageName; use language::LanguageName;
use settings::Settings as _; use settings::Settings as _;
use ui::{Button, ButtonCommon, Clickable, FluentBuilder, LabelSize, Tooltip}; use ui::{Button, ButtonCommon, Clickable, DynamicSpacing, FluentBuilder, LabelSize, Tooltip};
use workspace::{StatusItemView, Workspace, item::ItemHandle}; use workspace::{StatusItemView, Workspace, item::ItemHandle};
use crate::{LanguageSelector, Toggle}; use crate::{LanguageSelector, Toggle};
@ -54,7 +55,7 @@ impl Render for ActiveBufferLanguage {
"Unknown".to_string() "Unknown".to_string()
}; };
el.child( el.py(DynamicSpacing::Base04.rems(cx)).child(
Button::new("change-language", active_language_text) Button::new("change-language", active_language_text)
.label_size(LabelSize::Small) .label_size(LabelSize::Small)
.on_click(cx.listener(|this, _, window, cx| { .on_click(cx.listener(|this, _, window, cx| {

View file

@ -1007,7 +1007,7 @@ impl Render for LspTool {
let lsp_tool = cx.entity(); let lsp_tool = cx.entity();
div().child( div().py(DynamicSpacing::Base04.rems(cx)).child(
PopoverMenu::new("lsp-tool") PopoverMenu::new("lsp-tool")
.menu(move |_, cx| lsp_tool.read(cx).lsp_menu.clone()) .menu(move |_, cx| lsp_tool.read(cx).lsp_menu.clone())
.anchor(Corner::BottomLeft) .anchor(Corner::BottomLeft)

View file

@ -21,7 +21,7 @@ impl Render for SearchButton {
return button.w_0().invisible(); return button.w_0().invisible();
} }
button.child( button.py(DynamicSpacing::Base04.rems(cx)).child(
IconButton::new("project-search-indicator", SEARCH_ICON) IconButton::new("project-search-indicator", SEARCH_ICON)
.icon_size(IconSize::Small) .icon_size(IconSize::Small)
.tooltip(|window, cx| { .tooltip(|window, cx| {

View file

@ -2,12 +2,15 @@ use std::{path::Path, sync::Arc};
use editor::Editor; use editor::Editor;
use gpui::{ use gpui::{
AsyncWindowContext, Context, Entity, IntoElement, ParentElement, Render, Subscription, Task, AsyncWindowContext, Context, Entity, IntoElement, ParentElement, Render, Styled, Subscription,
WeakEntity, Window, div, Task, WeakEntity, Window, div,
}; };
use language::{Buffer, BufferEvent, LanguageName, Toolchain}; use language::{Buffer, BufferEvent, LanguageName, Toolchain};
use project::{Project, ProjectPath, WorktreeId, toolchain_store::ToolchainStoreEvent}; use project::{Project, ProjectPath, WorktreeId, toolchain_store::ToolchainStoreEvent};
use ui::{Button, ButtonCommon, Clickable, FluentBuilder, LabelSize, SharedString, Tooltip}; use ui::{
Button, ButtonCommon, Clickable, DynamicSpacing, FluentBuilder, LabelSize, SharedString,
Tooltip,
};
use util::maybe; use util::maybe;
use workspace::{StatusItemView, Workspace, item::ItemHandle}; use workspace::{StatusItemView, Workspace, item::ItemHandle};
@ -219,7 +222,7 @@ impl Render for ActiveToolchain {
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement { fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
div().when_some(self.active_toolchain.as_ref(), |el, active_toolchain| { div().when_some(self.active_toolchain.as_ref(), |el, active_toolchain| {
let term = self.term.clone(); let term = self.term.clone();
el.child( el.py(DynamicSpacing::Base04.rems(cx)).child(
Button::new("change-toolchain", active_toolchain.name.clone()) Button::new("change-toolchain", active_toolchain.name.clone())
.label_size(LabelSize::Small) .label_size(LabelSize::Small)
.on_click(cx.listener(|this, _, window, cx| { .on_click(cx.listener(|this, _, window, cx| {

View file

@ -110,9 +110,14 @@ impl Render for ModeIndicator {
format!("{} -- {} --", pending, mode).into() format!("{} -- {} --", pending, mode).into()
}; };
Label::new(label) div()
.size(LabelSize::Small) .py(DynamicSpacing::Base04.rems(cx))
.line_height_style(LineHeightStyle::UiLabel) .child(
Label::new(label)
.size(LabelSize::Small)
.line_height_style(LineHeightStyle::UiLabel)
.into_any_element(),
)
.into_any_element() .into_any_element()
} }
} }

View file

@ -938,6 +938,7 @@ impl Render for PanelButtons {
h_flex() h_flex()
.gap_1() .gap_1()
.when(has_buttons, |this| this.py(DynamicSpacing::Base04.rems(cx)))
.when( .when(
has_buttons && dock.position == DockPosition::Bottom, has_buttons && dock.position == DockPosition::Bottom,
|this| this.child(Divider::vertical().color(DividerColor::Border)), |this| this.child(Divider::vertical().color(DividerColor::Border)),

View file

@ -41,7 +41,6 @@ impl Render for StatusBar {
.w_full() .w_full()
.justify_between() .justify_between()
.gap(DynamicSpacing::Base08.rems(cx)) .gap(DynamicSpacing::Base08.rems(cx))
.py(DynamicSpacing::Base04.rems(cx))
.px(DynamicSpacing::Base06.rems(cx)) .px(DynamicSpacing::Base06.rems(cx))
.bg(cx.theme().colors().status_bar_background) .bg(cx.theme().colors().status_bar_background)
.map(|el| match window.window_decorations() { .map(|el| match window.window_decorations() {