gpui: Unify track_scroll method to receive a reference type (#43518)
Release Notes: - N/A This PR to change the `track_scroll` method to receive a reference type like the [Div#track_scroll](https://docs.rs/gpui/latest/gpui/trait.StatefulInteractiveElement.html#method.track_scroll), [Div#track_focus](https://docs.rs/gpui/latest/gpui/trait.InteractiveElement.html#method.track_focus). ```diff - .track_scroll(self.scroll_handle.clone()) + .track_scroll(&self.scroll_handle) - .vertical_scrollbar_for(self.scroll_handle.clone(), window, cx) + .vertical_scrollbar_for(&self.scroll_handle, window, cx) ``` https://github.com/zed-industries/zed/blob/56a2f9cfcf0c6a3c38f596b58002953763cd890f/crates/gpui/src/elements/div.rs#L1088-L1093 https://github.com/zed-industries/zed/blob/56a2f9cfcf0c6a3c38f596b58002953763cd890f/crates/gpui/src/elements/div.rs#L613-L620
This commit is contained in:
@@ -933,7 +933,7 @@ impl CompletionsMenu {
|
||||
)
|
||||
.occlude()
|
||||
.max_h(max_height_in_lines as f32 * window.line_height())
|
||||
.track_scroll(self.scroll_handle.clone())
|
||||
.track_scroll(&self.scroll_handle)
|
||||
.with_sizing_behavior(ListSizingBehavior::Infer)
|
||||
.map(|this| {
|
||||
if self.display_options.dynamic_width {
|
||||
@@ -948,7 +948,7 @@ impl CompletionsMenu {
|
||||
div().child(list).custom_scrollbars(
|
||||
Scrollbars::for_settings::<CompletionMenuScrollBarSetting>()
|
||||
.show_along(ScrollAxes::Vertical)
|
||||
.tracked_scroll_handle(self.scroll_handle.clone()),
|
||||
.tracked_scroll_handle(&self.scroll_handle),
|
||||
window,
|
||||
cx,
|
||||
),
|
||||
@@ -1599,7 +1599,7 @@ impl CodeActionsMenu {
|
||||
)
|
||||
.occlude()
|
||||
.max_h(max_height_in_lines as f32 * window.line_height())
|
||||
.track_scroll(self.scroll_handle.clone())
|
||||
.track_scroll(&self.scroll_handle)
|
||||
.with_width_from_item(
|
||||
self.actions
|
||||
.iter()
|
||||
|
||||
Reference in New Issue
Block a user