Changesets · Branches · Tags · Compare
| Changeset | d6d4195a8de78b4586f7b2ed7b2e1e4537960fe85d95a8e3e8d3eb57ad43ff29 |
|---|---|
| Author | Dallin Romney <dallinromney@gmail.com> · 2025-09-09 18:12 -07:00 |
| Committer | Dallin Romney <dallinromney@gmail.com> · 2025-09-09 18:12 -07:00 |
| Parents | 6b5cbdc99457, 8c097bfc78a4 |
1 file changed
modified gui/src/pages/gui/ToolCallDiv/FindAndReplace.tsx +2 −14
| @@ -4,7 +4,7 @@ | ||
| 4 | 4 | import { renderContextItems } from "core/util/messageContent"; |
| 5 | 5 | import { getLastNPathParts, getUriPathBasename } from "core/util/uri"; |
| 6 | 6 | import { diffLines } from "diff"; |
| 7 | -import { useContext, useEffect, useMemo, useRef, useState } from "react"; | |
| 7 | +import { useContext, useMemo, useState } from "react"; | |
| 8 | 8 | import { ApplyActions } from "../../../components/StyledMarkdownPreview/StepContainerPreToolbar/ApplyActions"; |
| 9 | 9 | import { FileInfo } from "../../../components/StyledMarkdownPreview/StepContainerPreToolbar/FileInfo"; |
| 10 | 10 | import { IdeMessengerContext } from "../../../context/IdeMessenger"; |
| @@ -77,8 +77,6 @@ | ||
| 77 | 77 | historyIndex, |
| 78 | 78 | }: FindAndReplaceDisplayProps) { |
| 79 | 79 | const [isExpanded, setIsExpanded] = useState<boolean | undefined>(undefined); |
| 80 | - const [diffWidth, setDiffWidth] = useState<number | undefined>(undefined); | |
| 81 | - const diffDivRef = useRef<HTMLDivElement>(null); | |
| 82 | 80 | const ideMessenger = useContext(IdeMessengerContext); |
| 83 | 81 | const applyState: ApplyState | undefined = useAppSelector((state) => |
| 84 | 82 | selectApplyStateByToolCallId(state, toolCallId), |
| @@ -238,22 +236,12 @@ | ||
| 238 | 236 | ); |
| 239 | 237 | } |
| 240 | 238 | |
| 241 | - useEffect(() => { | |
| 242 | - if (!diffDivRef.current) return; | |
| 243 | - const newWidth = | |
| 244 | - diffDivRef.current?.scrollWidth ?? | |
| 245 | - diffDivRef.current?.getBoundingClientRect().width; | |
| 246 | - setDiffWidth(newWidth ? Math.ceil(newWidth) : undefined); | |
| 247 | - }, [isExpanded]); | |
| 248 | - | |
| 249 | 239 | return renderContainer( |
| 250 | 240 | <div |
| 251 | 241 | className={`${config?.ui?.showChatScrollbar ? "thin-scrollbar" : "no-scrollbar"} max-h-72 overflow-auto`} |
| 252 | - ref={diffDivRef} | |
| 253 | 242 | > |
| 254 | 243 | <pre |
| 255 | - className={`bg-editor m-0 text-xs leading-tight ${config?.ui?.codeWrap ? "whitespace-pre-wrap" : "whitespace-pre"}`} | |
| 256 | - style={{ width: diffWidth ? `${diffWidth}px` : "100%" }} | |
| 244 | + className={`bg-editor m-0 w-full text-xs leading-tight ${config?.ui?.codeWrap ? "whitespace-pre-wrap" : "whitespace-pre"}`} | |
| 257 | 245 | > |
| 258 | 246 | {diffResult.diff?.map((part, index) => { |
| 259 | 247 | if (part.removed) { |