Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Merge branch 'main' into project_search_design

Mikaylaafebe3faf833
diff --cc crates/search/src/buffer_search.rs
index 3e13f49181d,d85d311b8f9..c31236023b5
--- a/crates/search/src/buffer_search.rs
+++ b/crates/search/src/buffer_search.rs
@@@ -519,20 -531,42 +532,21 @@@ impl BufferSearchBar
.into_any()
}
- fn render_close_button(
- &self,
- theme: &theme::Search,
- cx: &mut ViewContext<Self>,
- ) -> AnyElement<Self> {
- let tooltip = "Dismiss Buffer Search";
- let tooltip_style = theme::current(cx).tooltip.clone();
-
- enum CloseButton {}
- MouseEventHandler::new::<CloseButton, _>(0, cx, |state, _| {
- let style = theme.dismiss_button.style_for(state);
- Svg::new("icons/x_mark_8.svg")
- .with_color(style.color)
- .constrained()
- .with_width(style.icon_width)
- .aligned()
- .constrained()
- .with_width(style.button_width)
- .contained()
- .with_style(style.container)
- })
- .on_click(MouseButton::Left, move |_, this, cx| {
- this.dismiss(&Default::default(), cx)
- })
- .with_cursor_style(CursorStyle::PointingHand)
- .with_tooltip::<CloseButton>(
- 0,
- tooltip.to_string(),
- Some(Box::new(Dismiss)),
- tooltip_style,
- cx,
- )
- .into_any()
+ pub fn activate_search_mode(&mut self, mode: SearchMode, cx: &mut ViewContext<Self>) {
+ assert_ne!(
+ mode,
+ SearchMode::Semantic,
+ "Semantic search is not supported in buffer search"
+ );
+ if mode == self.current_mode {
+ return;
+ }
+ self.current_mode = mode;
+ let _ = self.update_matches(cx);
+ cx.notify();
}
- fn deploy(pane: &mut Pane, action: &Deploy, cx: &mut ViewContext<Pane>) {
+
+ fn deploy_bar(pane: &mut Pane, action: &Deploy, cx: &mut ViewContext<Pane>) {
let mut propagate_action = true;
if let Some(search_bar) = pane.toolbar().read(cx).item_of_type::<BufferSearchBar>() {
search_bar.update(cx, |search_bar, cx| {
diff --cc crates/theme/src/theme.rs
index df6dbe9f556,30a2e8caec7..4de0076825a
--- a/crates/theme/src/theme.rs
+++ b/crates/theme/src/theme.rs
@@@ -360,6 -398,8 +399,7 @@@ pub struct Toolbar
pub container: ContainerStyle,
pub height: f32,
pub item_spacing: f32,
- pub nav_button: Interactive<IconButton>,
+ pub toggleable_tool: Toggleable<Interactive<IconButton>>,
}
#[derive(Clone, Deserialize, Default, JsonSchema)]
diff --cc styles/src/style_tree/workspace.ts
index c78b9b2909c,d4eaeb99da3..ecfb572f7e8
--- a/styles/src/style_tree/workspace.ts
+++ b/styles/src/style_tree/workspace.ts
@@@ -132,6 -133,28 +133,11 @@@ export default function workspace(): an
background: background(theme.highest),
border: border(theme.highest, { bottom: true }),
item_spacing: 8,
- nav_button: interactive({
- base: {
- color: foreground(theme.highest, "on"),
- icon_width: 12,
- button_width: 24,
- corner_radius: 6,
- },
- state: {
- hovered: {
- color: foreground(theme.highest, "on", "hovered"),
- background: background(theme.highest, "on", "hovered"),
- },
- disabled: {
- color: foreground(theme.highest, "on", "disabled"),
- },
- },
- }),
+ toggleable_tool: toggleable_icon_button(theme, {
+ margin: { left: 8 },
+ variant: "ghost",
+ active_color: "accent",
+ }),
padding: { left: 8, right: 8, top: 4, bottom: 4 },
},
breadcrumb_height: 24,