gpui: Simplify uniform list API by removing entity param (#32480)
This PR also introduces `Context::processor`, a sibling of `Context::listener` that takes a strong pointer to entity and allows for a return result. Release Notes: - N/A Co-authored-by: Mikayla <mikayla@zed.dev>
This commit is contained in:
parent
c55630889a
commit
f567bb52ff
17 changed files with 80 additions and 77 deletions
|
@ -55,6 +55,7 @@ use project::{
|
|||
use serde::{Deserialize, Serialize};
|
||||
use settings::{Settings as _, SettingsStore};
|
||||
use std::future::Future;
|
||||
use std::ops::Range;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::{collections::HashSet, sync::Arc, time::Duration, usize};
|
||||
use strum::{IntoEnumIterator, VariantNames};
|
||||
|
@ -3710,8 +3711,10 @@ impl GitPanel {
|
|||
.relative()
|
||||
.overflow_hidden()
|
||||
.child(
|
||||
uniform_list(cx.entity().clone(), "entries", entry_count, {
|
||||
move |this, range, window, cx| {
|
||||
uniform_list(
|
||||
"entries",
|
||||
entry_count,
|
||||
cx.processor(move |this, range: Range<usize>, window, cx| {
|
||||
let mut items = Vec::with_capacity(range.end - range.start);
|
||||
|
||||
for ix in range {
|
||||
|
@ -3739,8 +3742,8 @@ impl GitPanel {
|
|||
}
|
||||
|
||||
items
|
||||
}
|
||||
})
|
||||
}),
|
||||
)
|
||||
.when(
|
||||
!self.horizontal_scrollbar.show_track
|
||||
&& self.horizontal_scrollbar.show_scrollbar,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue