History

agent_ui: Fix regression that made edited files unclickable (#48362)

There was a `when()` condition here looking at `hovered_edited_file_buttons`, which is never turned to true when hovering over the edited file button, and given we started to pass the hover styles, tooltip, and on_click handler inside the condition, they would never work. The solution here is to make these three things unconditional, so edited files are always clickable. Release Notes: - N/A

Danilo Leal committed 9 months ago

Commit e54480b1 parent 327cc601 file · +17 −29Browse files

Unified · Split

crates/agent_ui/src/acp/thread_view.rs+17−29
@@ -5764,7 +5764,6 @@ impl AcpServerView { · 5763 unmodified lines
57645764 })
57655765 }),
57665766 )
5767− .child(Divider::vertical().color(DividerColor::BorderVariant))
57685767 .child(
57695768 Button::new(("reject-file", index), "Reject")
57705769 .label_size(LabelSize::Small)
@@ -5919,34 +5918,23 @@ impl AcpServerView { · 148 unmodified lines
59195918 )
59205919 .label_size(LabelSize::XSmall),
59215920 )
5922− .when(
5923− match self.as_active_thread() {
5924− Some(thread) => {
5925− thread.hovered_edited_file_buttons == Some(index)
5926− }
5927− None => false,
5928− },
5929− |this| {
5930− let full_path = full_path.clone();
5931− this.hover(|s| s.bg(cx.theme().colors().element_hover))
5932− .tooltip(move |_, cx| {
5933− Tooltip::with_meta(
5934− "Go to File",
5935− None,
5936− full_path.clone(),
5937− cx,
5938− )
5939− })
5940− .on_click({
5941− let buffer = buffer.clone();
5942− cx.listener(move |this, _, window, cx| {
5943− this.open_edited_buffer(
5944− &buffer, window, cx,
5945− );
5946− })
5947− })
5948− },
5949− ),
5921+ .hover(|s| s.bg(cx.theme().colors().element_hover))
5922+ .tooltip({
5923+ move |_, cx| {
5924+ Tooltip::with_meta(
5925+ "Go to File",
5926+ None,
5927+ full_path.clone(),
5928+ cx,
5929+ )
5930+ }
5931+ })
5932+ .on_click({
5933+ let buffer = buffer.clone();
5934+ cx.listener(move |this, _, window, cx| {
5935+ this.open_edited_buffer(&buffer, window, cx);
5936+ })
5937+ }),
59505938 )
59515939 .child(buttons);
59525940

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t