From eb97698d3168d5b94664452a1f0ddd4fb8445194 Mon Sep 17 00:00:00 2001 From: dino Date: Mon, 27 Oct 2025 17:22:10 +0000 Subject: [PATCH] refactor: new fix --- crates/agent_ui/src/acp/message_editor.rs | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/crates/agent_ui/src/acp/message_editor.rs b/crates/agent_ui/src/acp/message_editor.rs index 6cfa825b3ebd3e13c01f2bae4abfbf275b71b0f9..da89489a38845f7f437cb348c21765e4bf9243bf 100644 --- a/crates/agent_ui/src/acp/message_editor.rs +++ b/crates/agent_ui/src/acp/message_editor.rs @@ -599,24 +599,14 @@ impl MessageEditor { ); } - self.editor.update(cx, |editor, cx| { - editor.request_autoscroll(editor::scroll::Autoscroll::fit(), cx); - }); - - cx.spawn(async |this, cx| { - // Wait 2 frames at 120 FPS. - cx.background_executor() - .timer(Duration::from_millis(16)) - .await; - - this.update(cx, |this, cx| { - this.editor.update(cx, |editor, cx| { + let editor = self.editor.clone(); + cx.on_next_frame(window, move |_, window, cx| { + cx.on_next_frame(window, move |_, _, cx| { + editor.update(cx, |editor, cx| { editor.request_autoscroll(editor::scroll::Autoscroll::fit(), cx); }); - }) - .ok(); - }) - .detach(); + }); + }); } fn confirm_mention_for_thread(