From 030b20ace93aabbf1939994e39bc95d28404bd9d Mon Sep 17 00:00:00 2001 From: Thorsten Ball Date: Tue, 23 Jan 2024 16:13:15 +0100 Subject: [PATCH] Fix scroll jitter by ignoring autoscroll events if following When following someone else we saw jitter because `ScrollPositionChanged` events were battling `SelectionsChanged` events, both of which were scrolling the viewport. This ignores the ScrollPositionChanged if autoscrolling is on. Co-authored-by: Antonio Co-authored-by: Julia --- crates/editor/src/items.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/editor/src/items.rs b/crates/editor/src/items.rs index 36a48b2937..11ea07ff5c 100644 --- a/crates/editor/src/items.rs +++ b/crates/editor/src/items.rs @@ -277,7 +277,7 @@ impl FollowableItem for Editor { .extend(ids.iter().map(ExcerptId::to_proto)); true } - EditorEvent::ScrollPositionChanged { .. } => { + EditorEvent::ScrollPositionChanged { autoscroll, .. } if !autoscroll => { let scroll_anchor = self.scroll_manager.anchor(); update.scroll_top_anchor = Some(serialize_anchor(&scroll_anchor.anchor)); update.scroll_x = scroll_anchor.offset.x;