fix(chat): allow editing historical messages while streaming and prevent auto-jump to bottom; ensure edit area scrolls into view

This commit is contained in:
Roo Code 2025-10-18 22:03:31 +00:00
parent e0c5248a0f
commit 97599786fc
2 changed files with 9 additions and 5 deletions

View file

@ -1164,9 +1164,11 @@ export const ChatRowContent = ({
className="flex-grow px-2 py-1 wrap-anywhere rounded-lg transition-colors"
onClick={(e) => {
e.stopPropagation()
if (!isStreaming) {
handleEditClick()
// Allow editing historical messages even while streaming; only block when this is the last message and streaming
if (isStreaming && isLast) {
return
}
handleEditClick()
}}
title={t("chat:queuedMessages.clickToEdit")}>
<Mention text={message.text} withShadow />
@ -1174,7 +1176,7 @@ export const ChatRowContent = ({
<div className="flex gap-2 pr-1">
<div
className="cursor-pointer shrink-0 opacity-0 group-hover:opacity-100 transition-opacity"
style={{ visibility: isStreaming ? "hidden" : "visible" }}
style={{ visibility: isStreaming && isLast ? "hidden" : "visible" }}
onClick={(e) => {
e.stopPropagation()
handleEditClick()

View file

@ -1384,7 +1384,9 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
const handleRowHeightChange = useCallback(
(isTaller: boolean) => {
if (!disableAutoScrollRef.current) {
// Only auto-scroll when user is already at the bottom.
// This prevents editing a historical message from forcing the list to jump to the bottom.
if (!disableAutoScrollRef.current && isAtBottom) {
if (isTaller) {
scrollToBottomSmooth()
} else {
@ -1392,7 +1394,7 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
}
}
},
[scrollToBottomSmooth, scrollToBottomAuto],
[scrollToBottomSmooth, scrollToBottomAuto, isAtBottom],
)
useEffect(() => {