diff --git a/webview-ui/src/components/ChatView.tsx b/webview-ui/src/components/ChatView.tsx index d2ca786..65419fc 100644 --- a/webview-ui/src/components/ChatView.tsx +++ b/webview-ui/src/components/ChatView.tsx @@ -1,5 +1,5 @@ import { VSCodeButton, VSCodeLink } from "@vscode/webview-ui-toolkit/react" -import { KeyboardEvent, useCallback, useEffect, useMemo, useRef, useState } from "react" +import { KeyboardEvent, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react" import vsDarkPlus from "react-syntax-highlighter/dist/esm/styles/prism/vsc-dark-plus" import DynamicTextArea from "react-textarea-autosize" import { useEvent, useMount } from "react-use" @@ -55,6 +55,8 @@ const ChatView = ({ const textAreaRef = useRef(null) const [textAreaDisabled, setTextAreaDisabled] = useState(false) const [isTextAreaFocused, setIsTextAreaFocused] = useState(false) + const textAreaContainerRef = useRef(null) + const [textAreaContainerHeight, setTextAreaContainerHeight] = useState(51) const [selectedImages, setSelectedImages] = useState([]) const [thumbnailsHeight, setThumbnailsHeight] = useState(0) @@ -457,6 +459,17 @@ const ChatView = ({ selectedImages.length >= MAX_IMAGES_PER_MESSAGE || isInputPipingToStdin + useLayoutEffect(() => { + if (textAreaContainerRef.current) { + let height = textAreaContainerRef.current.clientHeight + // some browsers return 0 for clientHeight + if (!height) { + height = textAreaContainerRef.current.getBoundingClientRect().height + } + setTextAreaContainerHeight(height) + } + }, []) + return (
+ style={{ fontSize: 18, marginLeft: -2, marginBottom: 0.5 }}>