Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/acp_tools/src/acp_tools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ impl Render for AcpTools {
.with_sizing_behavior(gpui::ListSizingBehavior::Auto)
.size_full(),
)
.vertical_scrollbar_for(connection.list_state.clone(), window, cx)
.vertical_scrollbar_for(&connection.list_state, window, cx)
.into_any()
}
}
Expand Down
8 changes: 2 additions & 6 deletions crates/agent_ui/src/acp/thread_history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -502,14 +502,10 @@ impl Render for AcpThreadHistory {
)
.p_1()
.pr_4()
.track_scroll(self.scroll_handle.clone())
.track_scroll(&self.scroll_handle)
.flex_grow(),
)
.vertical_scrollbar_for(
self.scroll_handle.clone(),
window,
cx,
)
.vertical_scrollbar_for(&self.scroll_handle, window, cx)
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion crates/agent_ui/src/acp/thread_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5896,7 +5896,7 @@ impl Render for AcpThreadView {
.flex_grow()
.into_any(),
)
.vertical_scrollbar_for(self.list_state.clone(), window, cx)
.vertical_scrollbar_for(&self.list_state, window, cx)
.into_any()
} else {
this.child(self.render_recent_history(cx)).into_any()
Expand Down
2 changes: 1 addition & 1 deletion crates/agent_ui/src/agent_configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,7 @@ impl Render for AgentConfiguration {
.child(self.render_context_servers_section(window, cx))
.child(self.render_provider_configuration_section(cx)),
)
.vertical_scrollbar_for(self.scroll_handle.clone(), window, cx),
.vertical_scrollbar_for(&self.scroll_handle, window, cx),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ impl Render for AddLlmProviderModal {
.child(
div()
.size_full()
.vertical_scrollbar_for(self.scroll_handle.clone(), window, cx)
.vertical_scrollbar_for(&self.scroll_handle, window, cx)
.child(
v_flex()
.id("modal_content")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,6 @@ impl ConfigureContextServerModal {

impl Render for ConfigureContextServerModal {
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
let scroll_handle = self.scroll_handle.clone();
div()
.elevation_3(cx)
.w(rems(34.))
Expand Down Expand Up @@ -849,7 +848,7 @@ impl Render for ConfigureContextServerModal {
.id("modal-content")
.max_h(vh(0.7, window))
.overflow_y_scroll()
.track_scroll(&scroll_handle)
.track_scroll(&self.scroll_handle)
.child(self.render_modal_description(window, cx))
.child(self.render_modal_content(cx))
.child(match &self.state {
Expand All @@ -862,7 +861,7 @@ impl Render for ConfigureContextServerModal {
}
}),
)
.vertical_scrollbar_for(scroll_handle, window, cx),
.vertical_scrollbar_for(&self.scroll_handle, window, cx),
),
)
.footer(self.render_modal_footer(cx)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ impl ConfigureContextServerToolsModal {
items
})),
)
.vertical_scrollbar_for(self.scroll_handle.clone(), window, cx)
.vertical_scrollbar_for(&self.scroll_handle, window, cx)
.into_any_element()
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/debugger_ui/src/session/running/breakpoint_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ impl BreakpointList {
)
.with_horizontal_sizing_behavior(gpui::ListHorizontalSizingBehavior::Unconstrained)
.with_width_from_item(self.max_width_index)
.track_scroll(self.scroll_handle.clone())
.track_scroll(&self.scroll_handle)
.flex_1()
}

Expand Down Expand Up @@ -776,7 +776,7 @@ impl Render for BreakpointList {
.child(self.render_list(cx))
.custom_scrollbars(
ui::Scrollbars::new(ScrollAxes::Both)
.tracked_scroll_handle(self.scroll_handle.clone())
.tracked_scroll_handle(&self.scroll_handle)
.with_track_along(ScrollAxes::Both, cx.theme().colors().panel_background)
.tracked_entity(cx.entity_id()),
window,
Expand Down
4 changes: 2 additions & 2 deletions crates/debugger_ui/src/session/running/memory_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ impl MemoryView {
rows
},
)
.track_scroll(view_state.scroll_handle)
.track_scroll(&view_state.scroll_handle)
.with_horizontal_sizing_behavior(ListHorizontalSizingBehavior::Unconstrained)
.on_scroll_wheel(cx.listener(|this, evt: &ScrollWheelEvent, window, _| {
let mut view_state = this.view_state();
Expand Down Expand Up @@ -921,7 +921,7 @@ impl Render for MemoryView {
}))
.custom_scrollbars(
ui::Scrollbars::new(ui::ScrollAxes::Both)
.tracked_scroll_handle(self.view_state_handle.clone())
.tracked_scroll_handle(&self.view_state_handle)
.with_track_along(
ui::ScrollAxes::Both,
cx.theme().colors().panel_background,
Expand Down
4 changes: 2 additions & 2 deletions crates/debugger_ui/src/session/running/module_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ impl ModuleList {
range.map(|ix| this.render_entry(ix, cx)).collect()
}),
)
.track_scroll(self.scroll_handle.clone())
.track_scroll(&self.scroll_handle)
.size_full()
}
}
Expand All @@ -279,6 +279,6 @@ impl Render for ModuleList {
.size_full()
.p_1()
.child(self.render_list(window, cx))
.vertical_scrollbar_for(self.scroll_handle.clone(), window, cx)
.vertical_scrollbar_for(&self.scroll_handle, window, cx)
}
}
2 changes: 1 addition & 1 deletion crates/debugger_ui/src/session/running/stack_frame_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ impl Render for StackFrameList {
)
})
.child(self.render_list(window, cx))
.vertical_scrollbar_for(self.list_state.clone(), window, cx)
.vertical_scrollbar_for(&self.list_state, window, cx)
}
}

Expand Down
6 changes: 3 additions & 3 deletions crates/debugger_ui/src/session/running/variable_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1557,7 +1557,7 @@ impl Render for VariableList {
this.render_entries(range, window, cx)
}),
)
.track_scroll(self.list_handle.clone())
.track_scroll(&self.list_handle)
.with_width_from_item(self.max_width_index)
.with_sizing_behavior(gpui::ListSizingBehavior::Auto)
.with_horizontal_sizing_behavior(gpui::ListHorizontalSizingBehavior::Unconstrained)
Expand All @@ -1574,10 +1574,10 @@ impl Render for VariableList {
)
.with_priority(1)
}))
// .vertical_scrollbar_for(self.list_handle.clone(), window, cx)
// .vertical_scrollbar_for(&self.list_handle, window, cx)
.custom_scrollbars(
ui::Scrollbars::new(ScrollAxes::Both)
.tracked_scroll_handle(self.list_handle.clone())
.tracked_scroll_handle(&self.list_handle)
.with_track_along(ScrollAxes::Both, cx.theme().colors().panel_background)
.tracked_entity(cx.entity_id()),
window,
Expand Down
6 changes: 3 additions & 3 deletions crates/editor/src/code_context_menus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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,
),
Expand Down Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions crates/editor/src/hover_popover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ impl InfoPopover {
)
.custom_scrollbars(
Scrollbars::for_settings::<EditorSettings>()
.tracked_scroll_handle(self.scroll_handle.clone()),
.tracked_scroll_handle(&self.scroll_handle),
window,
cx,
)
Expand Down Expand Up @@ -1012,7 +1012,7 @@ impl DiagnosticPopover {
)
.custom_scrollbars(
Scrollbars::for_settings::<EditorSettings>()
.tracked_scroll_handle(self.scroll_handle.clone()),
.tracked_scroll_handle(&self.scroll_handle),
window,
cx,
),
Expand Down
2 changes: 1 addition & 1 deletion crates/editor/src/signature_help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ impl SignatureHelpPopover {
)
}),
)
.vertical_scrollbar_for(self.scroll_handle.clone(), window, cx);
.vertical_scrollbar_for(&self.scroll_handle, window, cx);

let controls = if self.signatures.len() > 1 {
let prev_button = IconButton::new("signature_help_prev", IconName::ChevronUp)
Expand Down
4 changes: 2 additions & 2 deletions crates/extensions_ui/src/extensions_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1704,12 +1704,12 @@ impl Render for ExtensionsPage {
if count == 0 {
this.child(self.render_empty_state(cx)).into_any_element()
} else {
let scroll_handle = self.list.clone();
let scroll_handle = &self.list;
this.child(
uniform_list("entries", count, cx.processor(Self::render_extensions))
.flex_grow()
.pb_4()
.track_scroll(scroll_handle.clone()),
.track_scroll(scroll_handle),
)
.vertical_scrollbar_for(scroll_handle, window, cx)
.into_any_element()
Expand Down
4 changes: 2 additions & 2 deletions crates/git_ui/src/git_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3939,7 +3939,7 @@ impl GitPanel {
ListHorizontalSizingBehavior::Unconstrained,
)
.with_width_from_item(self.max_width_item_index)
.track_scroll(self.scroll_handle.clone()),
.track_scroll(&self.scroll_handle),
)
.on_mouse_down(
MouseButton::Right,
Expand All @@ -3949,7 +3949,7 @@ impl GitPanel {
)
.custom_scrollbars(
Scrollbars::for_settings::<GitPanelSettings>()
.tracked_scroll_handle(self.scroll_handle.clone())
.tracked_scroll_handle(&self.scroll_handle)
.with_track_along(
ScrollAxes::Horizontal,
cx.theme().colors().panel_background,
Expand Down
2 changes: 1 addition & 1 deletion crates/gpui/examples/data_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ impl Render for DataTable {
}),
)
.size_full()
.track_scroll(self.scroll_handle.clone()),
.track_scroll(&self.scroll_handle),
)
.child(self.render_scrollbar(window, cx)),
),
Expand Down
6 changes: 3 additions & 3 deletions crates/gpui/src/elements/uniform_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -668,9 +668,9 @@ impl UniformList {
}

/// Track and render scroll state of this list with reference to the given scroll handle.
pub fn track_scroll(mut self, handle: UniformListScrollHandle) -> Self {
pub fn track_scroll(mut self, handle: &UniformListScrollHandle) -> Self {
self.interactivity.tracked_scroll_handle = Some(handle.0.borrow().base_handle.clone());
self.scroll_handle = Some(handle);
self.scroll_handle = Some(handle.clone());
self
}

Expand Down Expand Up @@ -780,7 +780,7 @@ mod test {
.collect()
}),
)
.track_scroll(self.scroll_handle.clone())
.track_scroll(&self.scroll_handle)
.h(px(200.0)),
)
}
Expand Down
4 changes: 2 additions & 2 deletions crates/language_tools/src/syntax_tree_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -507,11 +507,11 @@ impl Render for SyntaxTreeView {
}),
)
.size_full()
.track_scroll(self.list_scroll_handle.clone())
.track_scroll(&self.list_scroll_handle)
.text_bg(cx.theme().colors().background)
.into_any_element(),
)
.vertical_scrollbar_for(self.list_scroll_handle.clone(), window, cx)
.vertical_scrollbar_for(&self.list_scroll_handle, window, cx)
.into_any_element()
} else {
let inner_content = v_flex()
Expand Down
2 changes: 1 addition & 1 deletion crates/markdown/src/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ impl Element for MarkdownElement {
{
let scrollbars = Scrollbars::new(ScrollAxes::Horizontal)
.id(("markdown-code-block-scrollbar", range.start))
.tracked_scroll_handle(scroll_handle.clone())
.tracked_scroll_handle(scroll_handle)
.with_track_along(
ScrollAxes::Horizontal,
cx.theme().colors().editor_background,
Expand Down
2 changes: 1 addition & 1 deletion crates/markdown_preview/src/markdown_preview_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,6 @@ impl Render for MarkdownPreviewView {
.size_full(),
)
}))
.vertical_scrollbar_for(self.list_state.clone(), window, cx)
.vertical_scrollbar_for(&self.list_state, window, cx)
}
}
4 changes: 2 additions & 2 deletions crates/miniprofiler_ui/src/miniprofiler_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,10 +400,10 @@ impl Render for ProfilerWindow {
this.autoscroll = false;
cx.notify();
}))
.track_scroll(self.scroll_handle.clone())
.track_scroll(&self.scroll_handle)
.size_full(),
)
.vertical_scrollbar_for(self.scroll_handle.clone(), window, cx),
.vertical_scrollbar_for(&self.scroll_handle, window, cx),
)
})
}
Expand Down
2 changes: 1 addition & 1 deletion crates/onboarding/src/onboarding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ impl Render for Onboarding {
.child(self.render_page(cx))
.track_scroll(&self.scroll_handle),
)
.vertical_scrollbar_for(self.scroll_handle.clone(), window, cx),
.vertical_scrollbar_for(&self.scroll_handle, window, cx),
)
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/outline_panel/src/outline_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4654,7 +4654,7 @@ impl OutlinePanel {
.with_sizing_behavior(ListSizingBehavior::Infer)
.with_horizontal_sizing_behavior(ListHorizontalSizingBehavior::Unconstrained)
.with_width_from_item(self.max_width_item_index)
.track_scroll(self.scroll_handle.clone())
.track_scroll(&self.scroll_handle)
.when(show_indent_guides, |list| {
list.with_decoration(
ui::indent_guides(px(indent_size), IndentGuideColors::panel(cx))
Expand Down Expand Up @@ -4707,7 +4707,7 @@ impl OutlinePanel {
.child(list_contents.size_full().flex_shrink())
.custom_scrollbars(
Scrollbars::for_settings::<OutlinePanelSettings>()
.tracked_scroll_handle(self.scroll_handle.clone())
.tracked_scroll_handle(&self.scroll_handle.clone())
.with_track_along(
ScrollAxes::Horizontal,
cx.theme().colors().panel_background,
Expand Down
6 changes: 3 additions & 3 deletions crates/picker/src/picker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ impl<D: PickerDelegate> Picker<D> {
})
.flex_grow()
.py_1()
.track_scroll(scroll_handle.clone())
.track_scroll(&scroll_handle)
.into_any_element(),
ElementContainer::List(state) => list(
state.clone(),
Expand Down Expand Up @@ -866,12 +866,12 @@ impl<D: PickerDelegate> Render for Picker<D> {

this.map(|this| match &self.element_container {
ElementContainer::List(state) => this.custom_scrollbars(
base_scrollbar_config.tracked_scroll_handle(state.clone()),
base_scrollbar_config.tracked_scroll_handle(state),
window,
cx,
),
ElementContainer::UniformList(state) => this.custom_scrollbars(
base_scrollbar_config.tracked_scroll_handle(state.clone()),
base_scrollbar_config.tracked_scroll_handle(state),
window,
cx,
),
Expand Down
Loading
Loading