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

View File

@@ -226,14 +226,16 @@ impl Relays {
_window: &mut Window, _window: &mut Window,
cx: &mut Context<Self>, cx: &mut Context<Self>,
) -> UniformList { ) -> UniformList {
let view = cx.entity();
let total = relays.len(); 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(); let mut items = Vec::new();
for ix in range { 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( items.push(
div().group("").w_full().h_9().py_0p5().child( div().group("").w_full().h_9().py_0p5().child(
@@ -264,7 +266,8 @@ impl Relays {
} }
items items
}) }),
)
.w_full() .w_full()
.min_h(px(MIN_HEIGHT)) .min_h(px(MIN_HEIGHT))
} }

View File

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

View File

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

View File

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