Compare commits

...

5 Commits

Author SHA1 Message Date
Joseph T. Lyons
d6453ecc64 zed 0.104.1 2023-09-14 17:40:36 -04:00
Kyle Caverly
b88adde7f1 small fix to rate status update (#2967)
Small fix to update code for rate limiting status.

Release Notes (Preview only)
- Fixed update to only stop updating status, when the rate limit is
reset to None
2023-09-14 17:36:25 -04:00
Piotr Osiewicz
1e4878e20f search_bar: Add toggle_replace_on_a_pane. (#2966)
This allows users to add a keybind to ToggleReplace from Editor/Pane
contexts.

Release Notes:
- Fixed replace in buffer not reacting to keyboard shortcuts outside of
search bar<preview-only>.
2023-09-14 17:35:56 -04:00
Joseph T. Lyons
522937b5f0 Fix toggle replace tooltip (#2964)
Release Notes:

- N/A
2023-09-13 20:25:16 -04:00
Joseph T. Lyons
787336613c v0.104.x preview 2023-09-13 12:21:55 -04:00
6 changed files with 26 additions and 5 deletions

2
Cargo.lock generated
View File

@@ -9794,7 +9794,7 @@ dependencies = [
[[package]]
name = "zed"
version = "0.104.0"
version = "0.104.1"
dependencies = [
"activity_indicator",
"ai",

View File

@@ -56,6 +56,7 @@ pub fn init(cx: &mut AppContext) {
cx.add_action(BufferSearchBar::replace_all_on_pane);
cx.add_action(BufferSearchBar::replace_next_on_pane);
cx.add_action(BufferSearchBar::toggle_replace);
cx.add_action(BufferSearchBar::toggle_replace_on_a_pane);
add_toggle_option_action::<ToggleCaseSensitive>(SearchOptions::CASE_SENSITIVE, cx);
add_toggle_option_action::<ToggleWholeWord>(SearchOptions::WHOLE_WORD, cx);
}
@@ -889,6 +890,21 @@ impl BufferSearchBar {
cx.notify();
}
}
fn toggle_replace_on_a_pane(pane: &mut Pane, _: &ToggleReplace, cx: &mut ViewContext<Pane>) {
let mut should_propagate = true;
if let Some(search_bar) = pane.toolbar().read(cx).item_of_type::<BufferSearchBar>() {
search_bar.update(cx, |bar, cx| {
if let Some(_) = &bar.active_searchable_item {
should_propagate = false;
bar.replace_is_active = !bar.replace_is_active;
cx.notify();
}
});
}
if should_propagate {
cx.propagate_action();
}
}
fn replace_next(&mut self, _: &ReplaceNext, cx: &mut ViewContext<Self>) {
if !self.dismissed && self.active_search.is_some() {
if let Some(searchable_item) = self.active_searchable_item.as_ref() {
@@ -934,12 +950,16 @@ impl BufferSearchBar {
fn replace_next_on_pane(pane: &mut Pane, action: &ReplaceNext, cx: &mut ViewContext<Pane>) {
if let Some(search_bar) = pane.toolbar().read(cx).item_of_type::<BufferSearchBar>() {
search_bar.update(cx, |bar, cx| bar.replace_next(action, cx));
return;
}
cx.propagate_action();
}
fn replace_all_on_pane(pane: &mut Pane, action: &ReplaceAll, cx: &mut ViewContext<Pane>) {
if let Some(search_bar) = pane.toolbar().read(cx).item_of_type::<BufferSearchBar>() {
search_bar.update(cx, |bar, cx| bar.replace_all(action, cx));
return;
}
cx.propagate_action();
}
}

View File

@@ -701,8 +701,9 @@ impl ProjectSearchView {
}));
return;
}
} else {
semantic_state.maintain_rate_limit = None;
}
semantic_state.maintain_rate_limit = None;
}
}

View File

@@ -110,7 +110,7 @@ fn toggle_replace_button<V: View>(
button_style: ToggleIconButtonStyle,
) -> AnyElement<V> {
Button::dynamic_action(Box::new(ToggleReplace))
.with_tooltip("Toggle replace", tooltip_style)
.with_tooltip("Toggle Replace", tooltip_style)
.with_contents(theme::components::svg::Svg::new("icons/replace.svg"))
.toggleable(active)
.with_style(button_style)

View File

@@ -3,7 +3,7 @@ authors = ["Nathan Sobo <nathansobo@gmail.com>"]
description = "The fast, collaborative code editor."
edition = "2021"
name = "zed"
version = "0.104.0"
version = "0.104.1"
publish = false
[lib]

View File

@@ -1 +1 @@
dev
preview