agent: Add use_modifier_to_send
section in the settings view (#34866)
This PR also converts all of these switch-based settings to use the new `SwitchField` component, introduced in https://github.com/zed-industries/zed/pull/34713. Release Notes: - agent: Added the ability to change the `use_modifier_to_send` setting from the agent panel settings UI.
This commit is contained in:
parent
c7158f0bd7
commit
a3850b3d38
2 changed files with 69 additions and 104 deletions
|
@ -588,7 +588,7 @@ impl SwitchField {
|
|||
toggle_state: toggle_state.into(),
|
||||
on_click: Arc::new(on_click),
|
||||
disabled: false,
|
||||
color: SwitchColor::default(),
|
||||
color: SwitchColor::Accent,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -634,6 +634,15 @@ impl RenderOnce for SwitchField {
|
|||
}
|
||||
}),
|
||||
)
|
||||
.when(!self.disabled, |this| {
|
||||
this.on_click({
|
||||
let on_click = self.on_click.clone();
|
||||
let toggle_state = self.toggle_state;
|
||||
move |_click, window, cx| {
|
||||
(on_click)(&toggle_state.inverse(), window, cx);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue