diff --git a/webview-ui/src/components/chat/ChatRow.tsx b/webview-ui/src/components/chat/ChatRow.tsx index 23ec50af37..d66366fd69 100644 --- a/webview-ui/src/components/chat/ChatRow.tsx +++ b/webview-ui/src/components/chat/ChatRow.tsx @@ -125,6 +125,7 @@ export const ChatRowContent = ({ const [editMode, setEditMode] = useState(mode || "code") const [editImages, setEditImages] = useState([]) const { copyWithFeedback } = useCopyToClipboard() + const userEditRef = useRef(null) // Handle message events for image selection during edit mode useEffect(() => { @@ -351,6 +352,22 @@ export const ChatRowContent = ({ return null }, [message.type, message.ask, message.partial, message.text]) + // Scroll to user edits when they appear + useEffect(() => { + if (message.say === "user_feedback_diff" && userEditRef.current) { + const tool = safeJsonParse(message.text) + if (tool?.diff) { + // Use a small delay to ensure the element is rendered + setTimeout(() => { + userEditRef.current?.scrollIntoView({ + behavior: "smooth", + block: "center", + }) + }, 100) + } + } + }, [message.say, message.text]) + if (tool) { const toolIcon = (name: string) => ( (message.text) return ( -
+