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
5764 })5764 })
5765 }),5765 }),
5766 )5766 )
5767 .child(Divider::vertical().color(DividerColor::BorderVariant))
5768 .child(5767 .child(
5769 Button::new(("reject-file", index), "Reject")5768 Button::new(("reject-file", index), "Reject")
5770 .label_size(LabelSize::Small)5769 .label_size(LabelSize::Small)
@@ -5919,34 +5918,23 @@ impl AcpServerView { · 148 unmodified lines
5919 )5918 )
5920 .label_size(LabelSize::XSmall),5919 .label_size(LabelSize::XSmall),
5921 )5920 )
5922 .when(5921 .hover(|s| s.bg(cx.theme().colors().element_hover))
5923 match self.as_active_thread() {5922 .tooltip({
5924 Some(thread) => {5923 move |_, cx| {
5925 thread.hovered_edited_file_buttons == Some(index)5924 Tooltip::with_meta(
5926 }5925 "Go to File",
5927 None => false,5926 None,
5928 },5927 full_path.clone(),
5929 |this| {5928 cx,
5930 let full_path = full_path.clone();5929 )
5931 this.hover(|s| s.bg(cx.theme().colors().element_hover))5930 }
5932 .tooltip(move |_, cx| {5931 })
5933 Tooltip::with_meta(5932 .on_click({
5934 "Go to File",5933 let buffer = buffer.clone();
5935 None,5934 cx.listener(move |this, _, window, cx| {
5936 full_path.clone(),5935 this.open_edited_buffer(&buffer, window, cx);
5937 cx,5936 })
5938 )5937 }),
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 ),
5950 )5938 )
5951 .child(buttons);5939 .child(buttons);
5952 5940

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