fix(scroll): no list flicker on touchpad overscroll at an edge
- gpui adds wheel deltas unclamped and clamps only in the next prepaint; the sidebar and calls list virtualised rows from that raw offset, so bottom rows rendered as spacers for a frame - scroll_edge::scroll_offset clamps the offset to the scroll range; sidebar, calls list and edge line read it - with_top_edge adds a capture guard that holds back wheel deltas past the top or bottom edge, so nothing re-renders there - gpui tests: touchpad overscroll at top and bottom changes nothing, overshoot is never rendered, scrolling away still works Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@@ -32,12 +32,60 @@ pub fn edge_divider(tag: &'static str) -> Div {
32
32
.bg(theme::border())
33
33
}
34
34
35
pub fn settled_offset(offset: Point<Pixels>, max_offset: Point<Pixels>) -> Point<Pixels> {
36
let settle = |value: Pixels, max: Pixels| value.max(-max.max(px(0.))).min(px(0.));
37
point(
38
settle(offset.x, max_offset.x),
39
settle(offset.y, max_offset.y),
40
)
41
}
42
43
pub fn scroll_offset(handle: &ScrollHandle) -> Point<Pixels> {
44
settled_offset(handle.offset(), handle.max_offset())
45
}
46
47
pub fn pushes_past_edge(offset_y: Pixels, max_offset_y: Pixels, delta: Point<Pixels>) -> bool {
48
let vertical = if delta.y.is_zero() { delta.x } else { delta.y };
49
if vertical > px(0.) {
50
!content_hidden_above(offset_y)
51
} else if vertical < px(0.) {
52
f32::from(offset_y + max_offset_y) <= SCROLLED_THRESHOLD
53
} else {
54
false
55
}
56
}
57
58
pub fn edge_scroll_guard(handle: &ScrollHandle) -> impl IntoElement {
59
let handle = handle.clone();
60
canvas(
61
|bounds, window, _| window.insert_hitbox(bounds, HitboxBehavior::Normal),
62
move |_, hitbox, window, _| {
63
window.on_mouse_event(move |event: &ScrollWheelEvent, phase, window, cx| {
64
if phase == DispatchPhase::Capture
65
&& hitbox.should_handle_scroll(window)
66
&& pushes_past_edge(
67
handle.offset().y,
68
handle.max_offset().y,
69
event.delta.pixel_delta(window.line_height()),
70
)
71
{
72
cx.stop_propagation();
73
}
74
});
75
},
76
)
77
.absolute()
78
.top_0()
79
.left_0()
80
.size_full()
81
}
82
35
83
pub fn with_top_edge(
36
84
scroll_area: impl IntoElement,
37
85
handle: &ScrollHandle,
38
86
tag: &'static str,
39
87
) -> Div {
40
let visible = edge_visible(EdgeRule::WhenScrolled, handle.offset().y);
88
let visible = edge_visible(EdgeRule::WhenScrolled, scroll_offset(handle).y);
41
89
div()
42
90
.relative()
43
91
.flex()
@@ -45,6 +93,7 @@ pub fn with_top_edge(
45
93
.flex_1()
46
94
.min_h_0()
47
95
.w_full()
96
.child(edge_scroll_guard(handle))
48
97
.child(scroll_area)
49
98
.when(visible, |area| {
50
99
area.child(edge_divider(tag).absolute().top_0().left_0().right_0())
@@ -53,9 +102,196 @@ pub fn with_top_edge(
53
102
54
103
#[cfg(test)]
55
104
mod tests {
56
use gpui_kit::px;
105
use std::cell::{Cell, RefCell};
106
use std::rc::Rc;
107
108
use gpui_kit::{
109
Context, Entity, InteractiveElement as _, IntoElement, ParentElement as _, Render,
110
ScrollDelta, ScrollHandle, ScrollWheelEvent, StatefulInteractiveElement as _, Styled as _,
111
TestAppContext, TouchPhase, VisualTestContext, Window, div, point, px,
112
};
113
114
use super::{
115
EdgeRule, content_hidden_above, edge_visible, pushes_past_edge, scroll_offset,
116
settled_offset, with_top_edge,
117
};
118
119
const EDGE_TAG: &str = "test-edge-line";
120
const ROW_HEIGHT: f32 = 40.;
121
const ROW_COUNT: usize = 60;
122
123
struct EdgeList {
124
handle: ScrollHandle,
125
rendered_offsets: Rc<RefCell<Vec<f32>>>,
126
}
127
128
impl Render for EdgeList {
129
fn render(&mut self, _window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {
130
self.rendered_offsets
131
.borrow_mut()
132
.push(f32::from(scroll_offset(&self.handle).y));
133
let rows =
134
(0..ROW_COUNT).map(|row_index| div().id(row_index).h(px(ROW_HEIGHT)).flex_none());
135
let scroll_area = div()
136
.id("edge-list")
137
.flex_1()
138
.min_h_0()
139
.overflow_y_scroll()
140
.track_scroll(&self.handle)
141
.children(rows);
142
div().size_full().flex().flex_col().child(with_top_edge(
143
scroll_area,
144
&self.handle,
145
EDGE_TAG,
146
))
147
}
148
}
149
150
struct Harness<'a> {
151
window_cx: &'a mut VisualTestContext,
152
handle: ScrollHandle,
153
notifications: Rc<Cell<usize>>,
154
rendered_offsets: Rc<RefCell<Vec<f32>>>,
155
}
156
157
impl Harness<'_> {
158
fn draw(&mut self) {
159
self.window_cx
160
.update(|window, cx| window.draw(cx).clear(cx));
161
}
162
163
fn wheel(&mut self, delta_y: f32, touch_phase: TouchPhase) {
164
self.window_cx.simulate_event(ScrollWheelEvent {
165
position: point(px(100.), px(200.)),
166
delta: ScrollDelta::Pixels(point(px(0.), px(delta_y))),
167
touch_phase,
168
..Default::default()
169
});
170
self.draw();
171
}
57
172
58
use super::{EdgeRule, content_hidden_above, edge_visible};
173
fn touchpad_swipe(&mut self, delta_y: f32, steps: usize) {
174
self.wheel(delta_y, TouchPhase::Started);
175
for _ in 0..steps {
176
self.wheel(delta_y, TouchPhase::Moved);
177
}
178
self.wheel(0., TouchPhase::Ended);
179
}
180
181
fn offset_y(&self) -> f32 {
182
f32::from(self.handle.offset().y)
183
}
184
185
fn shows_line(&mut self) -> bool {
186
self.window_cx.debug_bounds(EDGE_TAG).is_some()
187
}
188
}
189
190
fn open(cx: &mut TestAppContext) -> Harness<'_> {
191
cx.update(gpui_kit::init);
192
let handle = ScrollHandle::new();
193
let rendered_offsets = Rc::new(RefCell::new(Vec::new()));
194
let (view, window_cx): (Entity<EdgeList>, _) = cx.add_window_view({
195
let handle = handle.clone();
196
let rendered_offsets = rendered_offsets.clone();
197
move |_, _| EdgeList {
198
handle,
199
rendered_offsets,
200
}
201
});
202
let notifications = Rc::new(Cell::new(0));
203
window_cx.update({
204
let notifications = notifications.clone();
205
move |_, cx| {
206
cx.observe(&view, move |_, _| {
207
notifications.set(notifications.get() + 1)
208
})
209
.detach()
210
}
211
});
212
let mut harness = Harness {
213
window_cx,
214
handle,
215
notifications,
216
rendered_offsets,
217
};
218
harness.draw();
219
harness
220
}
221
222
#[gpui_kit::test]
223
fn touchpad_overscroll_at_the_top_changes_nothing(cx: &mut TestAppContext) {
224
let mut harness = open(cx);
225
harness.notifications.set(0);
226
harness.touchpad_swipe(35., 12);
227
assert_eq!(harness.offset_y(), 0.);
228
assert_eq!(harness.notifications.get(), 0, "no re-render at the edge");
229
assert!(!harness.shows_line());
230
}
231
232
#[gpui_kit::test]
233
fn touchpad_overscroll_at_the_bottom_changes_nothing(cx: &mut TestAppContext) {
234
let mut harness = open(cx);
235
harness.wheel(-100_000., TouchPhase::Moved);
236
let bottom = harness.offset_y();
237
assert!(bottom < -1000.);
238
harness.notifications.set(0);
239
harness.touchpad_swipe(-35., 12);
240
assert_eq!(harness.offset_y(), bottom);
241
assert_eq!(harness.notifications.get(), 0);
242
assert!(harness.shows_line());
243
}
244
245
#[gpui_kit::test]
246
fn overshoot_past_the_top_is_never_rendered(cx: &mut TestAppContext) {
247
let mut harness = open(cx);
248
harness.wheel(-10., TouchPhase::Moved);
249
assert_eq!(harness.offset_y(), -10.);
250
harness.rendered_offsets.borrow_mut().clear();
251
harness.touchpad_swipe(400., 2);
252
assert_eq!(harness.offset_y(), 0.);
253
let rendered = harness.rendered_offsets.borrow().clone();
254
assert!(
255
rendered.iter().all(|offset| *offset <= 0.),
256
"render saw an offset past the top: {rendered:?}"
257
);
258
assert!(!harness.shows_line());
259
}
260
261
#[gpui_kit::test]
262
fn scrolling_down_from_the_top_still_scrolls(cx: &mut TestAppContext) {
263
let mut harness = open(cx);
264
harness.touchpad_swipe(-30., 4);
265
assert_eq!(harness.offset_y(), -150.);
266
assert!(harness.shows_line());
267
harness.touchpad_swipe(30., 4);
268
assert_eq!(harness.offset_y(), 0.);
269
assert!(!harness.shows_line());
270
}
271
272
#[test]
273
fn settled_offset_stays_inside_the_scroll_range() {
274
let max = point(px(0.), px(500.));
275
assert_eq!(settled_offset(point(px(0.), px(120.)), max).y, px(0.));
276
assert_eq!(settled_offset(point(px(0.), px(-900.)), max).y, px(-500.));
277
assert_eq!(settled_offset(point(px(0.), px(-200.)), max).y, px(-200.));
278
assert_eq!(
279
settled_offset(point(px(0.), px(-40.)), point(px(0.), px(0.))).y,
280
px(0.)
281
);
282
}
283
284
#[test]
285
fn only_deltas_beyond_an_edge_are_held_back() {
286
let max = px(500.);
287
assert!(pushes_past_edge(px(0.), max, point(px(0.), px(30.))));
288
assert!(pushes_past_edge(px(0.), max, point(px(12.), px(0.))));
289
assert!(!pushes_past_edge(px(0.), max, point(px(0.), px(-30.))));
290
assert!(!pushes_past_edge(px(-10.), max, point(px(0.), px(30.))));
291
assert!(pushes_past_edge(px(-500.), max, point(px(0.), px(-30.))));
292
assert!(!pushes_past_edge(px(-500.), max, point(px(0.), px(30.))));
293
assert!(!pushes_past_edge(px(0.), max, point(px(0.), px(0.))));
294
}
59
295
60
296
#[test]
61
297
fn the_list_at_its_top_shows_no_line() {
@@ -32,12 +32,60 @@ pub fn edge_divider(tag: &'static str) -> Div {32
.bg(theme::border())32
.bg(theme::border())33
}33
}34
34
35
pub fn settled_offset(offset: Point<Pixels>, max_offset: Point<Pixels>) -> Point<Pixels> {36
let settle = |value: Pixels, max: Pixels| value.max(-max.max(px(0.))).min(px(0.));37
point(38
settle(offset.x, max_offset.x),39
settle(offset.y, max_offset.y),40
)41
}42
43
pub fn scroll_offset(handle: &ScrollHandle) -> Point<Pixels> {44
settled_offset(handle.offset(), handle.max_offset())45
}46
47
pub fn pushes_past_edge(offset_y: Pixels, max_offset_y: Pixels, delta: Point<Pixels>) -> bool {48
let vertical = if delta.y.is_zero() { delta.x } else { delta.y };49
if vertical > px(0.) {50
!content_hidden_above(offset_y)51
} else if vertical < px(0.) {52
f32::from(offset_y + max_offset_y) <= SCROLLED_THRESHOLD53
} else {54
false55
}56
}57
58
pub fn edge_scroll_guard(handle: &ScrollHandle) -> impl IntoElement {59
let handle = handle.clone();60
canvas(61
|bounds, window, _| window.insert_hitbox(bounds, HitboxBehavior::Normal),62
move |_, hitbox, window, _| {63
window.on_mouse_event(move |event: &ScrollWheelEvent, phase, window, cx| {64
if phase == DispatchPhase::Capture65
&& hitbox.should_handle_scroll(window)66
&& pushes_past_edge(67
handle.offset().y,68
handle.max_offset().y,69
event.delta.pixel_delta(window.line_height()),70
)71
{72
cx.stop_propagation();73
}74
});75
},76
)77
.absolute()78
.top_0()79
.left_0()80
.size_full()81
}82
35
pub fn with_top_edge(83
pub fn with_top_edge(36
scroll_area: impl IntoElement,84
scroll_area: impl IntoElement,37
handle: &ScrollHandle,85
handle: &ScrollHandle,38
tag: &'static str,86
tag: &'static str,39
) -> Div {87
) -> Div {40
let visible = edge_visible(EdgeRule::WhenScrolled, handle.offset().y);88
let visible = edge_visible(EdgeRule::WhenScrolled, scroll_offset(handle).y);41
div()89
div()42
.relative()90
.relative()43
.flex()91
.flex()@@ -45,6 +93,7 @@ pub fn with_top_edge(45
.flex_1()93
.flex_1()46
.min_h_0()94
.min_h_0()47
.w_full()95
.w_full()96
.child(edge_scroll_guard(handle))48
.child(scroll_area)97
.child(scroll_area)49
.when(visible, |area| {98
.when(visible, |area| {50
area.child(edge_divider(tag).absolute().top_0().left_0().right_0())99
area.child(edge_divider(tag).absolute().top_0().left_0().right_0())@@ -53,9 +102,196 @@ pub fn with_top_edge(53
102
54
#[cfg(test)]103
#[cfg(test)]55
mod tests {104
mod tests {56
use gpui_kit::px;105
use std::cell::{Cell, RefCell};106
use std::rc::Rc;107
108
use gpui_kit::{109
Context, Entity, InteractiveElement as _, IntoElement, ParentElement as _, Render,110
ScrollDelta, ScrollHandle, ScrollWheelEvent, StatefulInteractiveElement as _, Styled as _,111
TestAppContext, TouchPhase, VisualTestContext, Window, div, point, px,112
};113
114
use super::{115
EdgeRule, content_hidden_above, edge_visible, pushes_past_edge, scroll_offset,116
settled_offset, with_top_edge,117
};118
119
const EDGE_TAG: &str = "test-edge-line";120
const ROW_HEIGHT: f32 = 40.;121
const ROW_COUNT: usize = 60;122
123
struct EdgeList {124
handle: ScrollHandle,125
rendered_offsets: Rc<RefCell<Vec<f32>>>,126
}127
128
impl Render for EdgeList {129
fn render(&mut self, _window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {130
self.rendered_offsets131
.borrow_mut()132
.push(f32::from(scroll_offset(&self.handle).y));133
let rows =134
(0..ROW_COUNT).map(|row_index| div().id(row_index).h(px(ROW_HEIGHT)).flex_none());135
let scroll_area = div()136
.id("edge-list")137
.flex_1()138
.min_h_0()139
.overflow_y_scroll()140
.track_scroll(&self.handle)141
.children(rows);142
div().size_full().flex().flex_col().child(with_top_edge(143
scroll_area,144
&self.handle,145
EDGE_TAG,146
))147
}148
}149
150
struct Harness<'a> {151
window_cx: &'a mut VisualTestContext,152
handle: ScrollHandle,153
notifications: Rc<Cell<usize>>,154
rendered_offsets: Rc<RefCell<Vec<f32>>>,155
}156
157
impl Harness<'_> {158
fn draw(&mut self) {159
self.window_cx160
.update(|window, cx| window.draw(cx).clear(cx));161
}162
163
fn wheel(&mut self, delta_y: f32, touch_phase: TouchPhase) {164
self.window_cx.simulate_event(ScrollWheelEvent {165
position: point(px(100.), px(200.)),166
delta: ScrollDelta::Pixels(point(px(0.), px(delta_y))),167
touch_phase,168
..Default::default()169
});170
self.draw();171
}57
172
58
use super::{EdgeRule, content_hidden_above, edge_visible};173
fn touchpad_swipe(&mut self, delta_y: f32, steps: usize) {174
self.wheel(delta_y, TouchPhase::Started);175
for _ in 0..steps {176
self.wheel(delta_y, TouchPhase::Moved);177
}178
self.wheel(0., TouchPhase::Ended);179
}180
181
fn offset_y(&self) -> f32 {182
f32::from(self.handle.offset().y)183
}184
185
fn shows_line(&mut self) -> bool {186
self.window_cx.debug_bounds(EDGE_TAG).is_some()187
}188
}189
190
fn open(cx: &mut TestAppContext) -> Harness<'_> {191
cx.update(gpui_kit::init);192
let handle = ScrollHandle::new();193
let rendered_offsets = Rc::new(RefCell::new(Vec::new()));194
let (view, window_cx): (Entity<EdgeList>, _) = cx.add_window_view({195
let handle = handle.clone();196
let rendered_offsets = rendered_offsets.clone();197
move |_, _| EdgeList {198
handle,199
rendered_offsets,200
}201
});202
let notifications = Rc::new(Cell::new(0));203
window_cx.update({204
let notifications = notifications.clone();205
move |_, cx| {206
cx.observe(&view, move |_, _| {207
notifications.set(notifications.get() + 1)208
})209
.detach()210
}211
});212
let mut harness = Harness {213
window_cx,214
handle,215
notifications,216
rendered_offsets,217
};218
harness.draw();219
harness220
}221
222
#[gpui_kit::test]223
fn touchpad_overscroll_at_the_top_changes_nothing(cx: &mut TestAppContext) {224
let mut harness = open(cx);225
harness.notifications.set(0);226
harness.touchpad_swipe(35., 12);227
assert_eq!(harness.offset_y(), 0.);228
assert_eq!(harness.notifications.get(), 0, "no re-render at the edge");229
assert!(!harness.shows_line());230
}231
232
#[gpui_kit::test]233
fn touchpad_overscroll_at_the_bottom_changes_nothing(cx: &mut TestAppContext) {234
let mut harness = open(cx);235
harness.wheel(-100_000., TouchPhase::Moved);236
let bottom = harness.offset_y();237
assert!(bottom < -1000.);238
harness.notifications.set(0);239
harness.touchpad_swipe(-35., 12);240
assert_eq!(harness.offset_y(), bottom);241
assert_eq!(harness.notifications.get(), 0);242
assert!(harness.shows_line());243
}244
245
#[gpui_kit::test]246
fn overshoot_past_the_top_is_never_rendered(cx: &mut TestAppContext) {247
let mut harness = open(cx);248
harness.wheel(-10., TouchPhase::Moved);249
assert_eq!(harness.offset_y(), -10.);250
harness.rendered_offsets.borrow_mut().clear();251
harness.touchpad_swipe(400., 2);252
assert_eq!(harness.offset_y(), 0.);253
let rendered = harness.rendered_offsets.borrow().clone();254
assert!(255
rendered.iter().all(|offset| *offset <= 0.),256
"render saw an offset past the top: {rendered:?}"257
);258
assert!(!harness.shows_line());259
}260
261
#[gpui_kit::test]262
fn scrolling_down_from_the_top_still_scrolls(cx: &mut TestAppContext) {263
let mut harness = open(cx);264
harness.touchpad_swipe(-30., 4);265
assert_eq!(harness.offset_y(), -150.);266
assert!(harness.shows_line());267
harness.touchpad_swipe(30., 4);268
assert_eq!(harness.offset_y(), 0.);269
assert!(!harness.shows_line());270
}271
272
#[test]273
fn settled_offset_stays_inside_the_scroll_range() {274
let max = point(px(0.), px(500.));275
assert_eq!(settled_offset(point(px(0.), px(120.)), max).y, px(0.));276
assert_eq!(settled_offset(point(px(0.), px(-900.)), max).y, px(-500.));277
assert_eq!(settled_offset(point(px(0.), px(-200.)), max).y, px(-200.));278
assert_eq!(279
settled_offset(point(px(0.), px(-40.)), point(px(0.), px(0.))).y,280
px(0.)281
);282
}283
284
#[test]285
fn only_deltas_beyond_an_edge_are_held_back() {286
let max = px(500.);287
assert!(pushes_past_edge(px(0.), max, point(px(0.), px(30.))));288
assert!(pushes_past_edge(px(0.), max, point(px(12.), px(0.))));289
assert!(!pushes_past_edge(px(0.), max, point(px(0.), px(-30.))));290
assert!(!pushes_past_edge(px(-10.), max, point(px(0.), px(30.))));291
assert!(pushes_past_edge(px(-500.), max, point(px(0.), px(-30.))));292
assert!(!pushes_past_edge(px(-500.), max, point(px(0.), px(30.))));293
assert!(!pushes_past_edge(px(0.), max, point(px(0.), px(0.))));294
}59
295
60
#[test]296
#[test]61
fn the_list_at_its_top_shows_no_line() {297
fn the_list_at_its_top_shows_no_line() {@@ -39,6 +39,7 @@ impl Render for ScrollContainer {
39
39
div()
40
40
.id(row_index)
41
41
.h(px(ROW_HEIGHT))
42
.flex_none()
42
43
.w_full()
43
44
.on_click(move |_, _, _| left.set(left.get() + 1))
44
45
.on_mouse_down(MouseButton::Right, move |_, _, _| {
@@ -59,6 +60,7 @@ impl Render for VirtualList {
59
60
div()
60
61
.id(row_index)
61
62
.h(px(ROW_HEIGHT))
63
.flex_none()
62
64
.w_full()
63
65
.into_any_element()
64
66
})
@@ -39,6 +39,7 @@ impl Render for ScrollContainer {39
div()39
div()40
.id(row_index)40
.id(row_index)41
.h(px(ROW_HEIGHT))41
.h(px(ROW_HEIGHT))42
.flex_none()42
.w_full()43
.w_full()43
.on_click(move |_, _, _| left.set(left.get() + 1))44
.on_click(move |_, _, _| left.set(left.get() + 1))44
.on_mouse_down(MouseButton::Right, move |_, _, _| {45
.on_mouse_down(MouseButton::Right, move |_, _, _| {@@ -59,6 +60,7 @@ impl Render for VirtualList {59
div()60
div()60
.id(row_index)61
.id(row_index)61
.h(px(ROW_HEIGHT))62
.h(px(ROW_HEIGHT))63
.flex_none()62
.w_full()64
.w_full()63
.into_any_element()65
.into_any_element()64
})66
})@@ -11,7 +11,7 @@ use gpui_kit::*;
11
11
use super::avatar::person_avatar;
12
12
use super::join_dialog::open_join_with_id;
13
13
use super::new_meeting_dialog::open_new_meeting;
14
use super::scroll_edge::with_top_edge;
14
use super::scroll_edge::{scroll_offset, with_top_edge};
15
15
use super::sidebar::SIDEBAR_SCROLL_DIVIDER;
16
16
use super::widgets::{icon, menu_icon};
17
17
use crate::app_state::AppState;
@@ -411,7 +411,7 @@ pub fn calls_body(
411
411
let rebuild_state = state.clone();
412
412
cx.defer(move |cx| rebuild_state.update(cx, |state, cx| state.rebuild_calls_list(cx)));
413
413
}
414
let top = -f32::from(scroll.offset().y);
414
let top = -f32::from(scroll_offset(scroll).y);
415
415
let measured = f32::from(scroll.bounds().size.height);
416
416
let height = if measured > 1. {
417
417
measured
@@ -11,7 +11,7 @@ use gpui_kit::*;11
use super::avatar::person_avatar;11
use super::avatar::person_avatar;12
use super::join_dialog::open_join_with_id;12
use super::join_dialog::open_join_with_id;13
use super::new_meeting_dialog::open_new_meeting;13
use super::new_meeting_dialog::open_new_meeting;14
use super::scroll_edge::with_top_edge;14
use super::scroll_edge::{scroll_offset, with_top_edge};15
use super::sidebar::SIDEBAR_SCROLL_DIVIDER;15
use super::sidebar::SIDEBAR_SCROLL_DIVIDER;16
use super::widgets::{icon, menu_icon};16
use super::widgets::{icon, menu_icon};17
use crate::app_state::AppState;17
use crate::app_state::AppState;@@ -411,7 +411,7 @@ pub fn calls_body(411
let rebuild_state = state.clone();411
let rebuild_state = state.clone();412
cx.defer(move |cx| rebuild_state.update(cx, |state, cx| state.rebuild_calls_list(cx)));412
cx.defer(move |cx| rebuild_state.update(cx, |state, cx| state.rebuild_calls_list(cx)));413
}413
}414
let top = -f32::from(scroll.offset().y);414
let top = -f32::from(scroll_offset(scroll).y);415
let measured = f32::from(scroll.bounds().size.height);415
let measured = f32::from(scroll.bounds().size.height);416
let height = if measured > 1. {416
let height = if measured > 1. {417
measured417
measured@@ -19,7 +19,7 @@ use super::activity_panel::ActivityPanel;
19
19
use super::avatar::{spec_avatar, square_avatar, with_presence};
20
20
use super::calls_tab::calls_body;
21
21
use super::saved_panel::SavedPanel;
22
use super::scroll_edge::with_top_edge;
22
use super::scroll_edge::{scroll_offset, with_top_edge};
23
23
use super::section_dialog::{SectionNameTarget, open_section_name_dialog};
24
24
use super::widgets::{count_badge, icon, menu_icon, page_header, unread_marker};
25
25
use crate::agents::AgentsPanel;
@@ -1264,7 +1264,7 @@ impl SidebarView {
1264
1264
(sections, section_menus, menu, state.local_previews.clone())
1265
1265
};
1266
1266
1267
let top = -f32::from(self.chats_scroll.offset().y);
1267
let top = -f32::from(scroll_offset(&self.chats_scroll).y);
1268
1268
let measured: f32 = f32::from(self.chats_scroll.bounds().size.height);
1269
1269
let height = if measured > 1. {
1270
1270
measured
@@ -19,7 +19,7 @@ use super::activity_panel::ActivityPanel;19
use super::avatar::{spec_avatar, square_avatar, with_presence};19
use super::avatar::{spec_avatar, square_avatar, with_presence};20
use super::calls_tab::calls_body;20
use super::calls_tab::calls_body;21
use super::saved_panel::SavedPanel;21
use super::saved_panel::SavedPanel;22
use super::scroll_edge::with_top_edge;22
use super::scroll_edge::{scroll_offset, with_top_edge};23
use super::section_dialog::{SectionNameTarget, open_section_name_dialog};23
use super::section_dialog::{SectionNameTarget, open_section_name_dialog};24
use super::widgets::{count_badge, icon, menu_icon, page_header, unread_marker};24
use super::widgets::{count_badge, icon, menu_icon, page_header, unread_marker};25
use crate::agents::AgentsPanel;25
use crate::agents::AgentsPanel;@@ -1264,7 +1264,7 @@ impl SidebarView {1264
(sections, section_menus, menu, state.local_previews.clone())1264
(sections, section_menus, menu, state.local_previews.clone())1265
};1265
};1266
1266
1267
let top = -f32::from(self.chats_scroll.offset().y);1267
let top = -f32::from(scroll_offset(&self.chats_scroll).y);1268
let measured: f32 = f32::from(self.chats_scroll.bounds().size.height);1268
let measured: f32 = f32::from(self.chats_scroll.bounds().size.height);1269
let height = if measured > 1. {1269
let height = if measured > 1. {1270
measured1270
measured