chore: update gpui

This commit is contained in:
2025-06-17 08:00:47 +07:00
parent 440f17af18
commit 5f8e886a34
6 changed files with 366 additions and 213 deletions

450
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -360,7 +360,6 @@ impl Render for Compose {
)
.map(|this| {
let contacts = self.contacts.read(cx).clone();
let view = cx.entity();
if contacts.is_empty() {
this.child(
@@ -389,15 +388,15 @@ impl Render for Compose {
} else {
this.child(
uniform_list(
view,
"contacts",
contacts.len(),
move |this, range, _window, cx| {
cx.processor(move |this, range, _window, cx| {
let selected = this.selected.read(cx);
let mut items = Vec::new();
for ix in range {
let item = contacts.get(ix).unwrap().clone();
let profile: &Profile = contacts.get(ix).unwrap();
let item = profile.clone();
let is_select = selected.contains(&item.public_key());
items.push(
@@ -446,7 +445,7 @@ impl Render for Compose {
}
items
},
}),
)
.pb_4()
.min_h(px(280.)),

View File

@@ -226,14 +226,16 @@ impl Relays {
_window: &mut Window,
cx: &mut Context<Self>,
) -> UniformList {
let view = cx.entity();
let total = relays.len();
uniform_list(view, "relays", total, move |_, range, _window, cx| {
uniform_list(
"relays",
total,
cx.processor(move |_, range, _window, cx| {
let mut items = Vec::new();
for ix in range {
let item = relays.get(ix).unwrap().clone().to_string();
let item = relays.get(ix).map(|i: &RelayUrl| i.to_string()).unwrap();
items.push(
div().group("").w_full().h_9().py_0p5().child(
@@ -264,7 +266,8 @@ impl Relays {
}
items
})
}),
)
.w_full()
.min_h(px(MIN_HEIGHT))
}

View File

@@ -410,7 +410,7 @@ impl Sidebar {
})
}
fn render_uniform_item(
fn list_items(
&self,
rooms: &[Entity<Room>],
range: Range<usize>,
@@ -634,12 +634,11 @@ impl Render for Sidebar {
})
.child(
uniform_list(
cx.entity(),
"rooms",
rooms.len(),
move |this, range, _window, cx| {
this.render_uniform_item(&rooms, range, cx)
},
cx.processor(move |this, range, _window, cx| {
this.list_items(&rooms, range, cx)
}),
)
.h_full(),
),

View File

@@ -1,4 +1,5 @@
use std::cell::Cell;
use std::ops::Range;
use std::rc::Rc;
use std::time::Duration;
@@ -542,7 +543,6 @@ where
D: ListDelegate,
{
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
let view = cx.entity().clone();
let vertical_scroll_handle = self.vertical_scroll_handle.clone();
let items_count = self.delegate.items_count(cx);
let loading = self.delegate.loading(cx);
@@ -612,22 +612,28 @@ where
})
.when(items_count > 0, |this| {
this.child(
uniform_list(view, "uniform-list", items_count, {
move |list, visible_range, window, cx| {
uniform_list(
"list",
items_count,
cx.processor(
move |list, range: Range<usize>, window, cx| {
list.load_more_if_need(
items_count,
visible_range.end,
range.end,
window,
cx,
);
visible_range
range
.map(|ix| {
list.render_list_item(ix, window, cx)
list.render_list_item(
ix, window, cx,
)
})
.collect::<Vec<_>>()
}
})
},
),
)
.flex_grow()
.with_sizing_behavior(sizing_behavior)
.track_scroll(vertical_scroll_handle)

View File

@@ -1,5 +1,5 @@
[toolchain]
channel = "1.86"
channel = "1.87"
profile = "minimal"
components = ["rustfmt", "clippy"]
targets = [