From 071ac2150334746d3f0912cf45133f26ce447cb1 Mon Sep 17 00:00:00 2001 From: PiedPiper911 <32931126+PiedPiper911@users.noreply.github.com> Date: Wed, 15 Jul 2026 12:51:25 +0800 Subject: [PATCH 1/2] fix: prevent scroll position jump when user scrolls up during content updates (#5009) --- packages/cli/src/ui/components/shared/VirtualizedList.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/ui/components/shared/VirtualizedList.tsx b/packages/cli/src/ui/components/shared/VirtualizedList.tsx index c3f888ba5f6..48f3a12a82d 100644 --- a/packages/cli/src/ui/components/shared/VirtualizedList.tsx +++ b/packages/cli/src/ui/components/shared/VirtualizedList.tsx @@ -354,7 +354,11 @@ function VirtualizedList( prevTotalHeight.current - prevContainerHeight.current - 1; const wasAtBottom = contentPreviouslyFit || wasScrolledToBottomPixels; - if (wasAtBottom && actualScrollTop >= prevScrollTop.current) { + // Only re-enable isStickingToBottom when the user is genuinely at the + // bottom (not just when content previously fit). This prevents the scroll + // from jumping back to the bottom when the user has scrolled up to review + // changes (e.g., after Ctrl+S) and new content arrives. (#5009) + if (wasScrolledToBottomPixels && actualScrollTop >= prevScrollTop.current) { if (!isStickingToBottom) { setIsStickingToBottom(true); } From dd578ffbbb75b269a50a217dde318c3f8cd92eed Mon Sep 17 00:00:00 2001 From: PiedPiper911 <32931126+PiedPiper911@users.noreply.github.com> Date: Wed, 15 Jul 2026 22:47:22 +0800 Subject: [PATCH 2/2] fix: add !contentPreviouslyFit guard to prevent scroll jump when content fits When content fits within the container, wasScrolledToBottomPixels evaluates to true (threshold goes negative). Adding !contentPreviouslyFit explicitly prevents re-enabling isStickingToBottom in that edge case. Addresses review feedback from gemini-code-assist. --- packages/cli/src/ui/components/shared/VirtualizedList.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/src/ui/components/shared/VirtualizedList.tsx b/packages/cli/src/ui/components/shared/VirtualizedList.tsx index 48f3a12a82d..61e21766116 100644 --- a/packages/cli/src/ui/components/shared/VirtualizedList.tsx +++ b/packages/cli/src/ui/components/shared/VirtualizedList.tsx @@ -358,7 +358,7 @@ function VirtualizedList( // bottom (not just when content previously fit). This prevents the scroll // from jumping back to the bottom when the user has scrolled up to review // changes (e.g., after Ctrl+S) and new content arrives. (#5009) - if (wasScrolledToBottomPixels && actualScrollTop >= prevScrollTop.current) { + if (!contentPreviouslyFit && wasScrolledToBottomPixels && actualScrollTop >= prevScrollTop.current) { if (!isStickingToBottom) { setIsStickingToBottom(true); }