Skip to content

Commit b543bd9

Browse files
authored
Merge pull request #654 from psv2522/better-border-on-input-focus
fix:Made the main inputbox focus styling better, added better spacing in openai compatible section
2 parents d1bfbc6 + cd09571 commit b543bd9

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

webview-ui/src/components/chat/ChatTextArea.tsx

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
103103
const [intendedCursorPosition, setIntendedCursorPosition] = useState<number | null>(null)
104104
const contextMenuContainerRef = useRef<HTMLDivElement>(null)
105105
const [isEnhancingPrompt, setIsEnhancingPrompt] = useState(false)
106+
const [isFocused, setIsFocused] = useState(false)
106107

107108
// Fetch git commits when Git is selected or when typing a hash
108109
useEffect(() => {
@@ -379,6 +380,7 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
379380
if (!isMouseDownOnMenu) {
380381
setShowContextMenu(false)
381382
}
383+
setIsFocused(false)
382384
}, [isMouseDownOnMenu])
383385

384386
const handlePaste = useCallback(
@@ -537,6 +539,10 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
537539
backgroundColor: "var(--vscode-input-background)",
538540
margin: "10px 15px",
539541
padding: "8px",
542+
outline: "none",
543+
border: "1px solid",
544+
borderColor: isFocused ? "var(--vscode-focusBorder)" : "transparent",
545+
borderRadius: "2px",
540546
}}
541547
onDrop={async (e) => {
542548
e.preventDefault()
@@ -627,7 +633,8 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
627633
fontFamily: "var(--vscode-font-family)",
628634
fontSize: "var(--vscode-editor-font-size)",
629635
lineHeight: "var(--vscode-editor-line-height)",
630-
padding: "8px",
636+
padding: "2px",
637+
paddingRight: "8px",
631638
marginBottom: thumbnailsHeight > 0 ? `${thumbnailsHeight + 16}px` : 0,
632639
zIndex: 1,
633640
}}
@@ -647,6 +654,7 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
647654
handleInputChange(e)
648655
updateHighlights()
649656
}}
657+
onFocus={() => setIsFocused(true)}
650658
onKeyDown={handleKeyDown}
651659
onKeyUp={handleKeyUp}
652660
onBlur={handleBlur}
@@ -660,11 +668,12 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
660668
onHeightChange?.(height)
661669
}}
662670
placeholder={placeholderText}
663-
minRows={2}
664-
maxRows={20}
671+
minRows={3}
672+
maxRows={15}
665673
autoFocus={true}
666674
style={{
667675
width: "100%",
676+
outline: "none",
668677
boxSizing: "border-box",
669678
backgroundColor: "transparent",
670679
color: "var(--vscode-input-foreground)",
@@ -676,11 +685,13 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
676685
overflowX: "hidden",
677686
overflowY: "auto",
678687
border: "none",
679-
padding: "8px",
688+
padding: "2px",
689+
paddingRight: "8px",
680690
marginBottom: thumbnailsHeight > 0 ? `${thumbnailsHeight + 16}px` : 0,
681691
cursor: textAreaDisabled ? "not-allowed" : undefined,
682692
flex: "0 1 auto",
683693
zIndex: 2,
694+
scrollbarWidth: "none",
684695
}}
685696
onScroll={() => updateHighlights()}
686697
/>
@@ -696,7 +707,7 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
696707
bottom: "36px",
697708
left: "16px",
698709
zIndex: 2,
699-
marginBottom: "8px",
710+
marginBottom: "4px",
700711
}}
701712
/>
702713
)}
@@ -707,7 +718,7 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
707718
justifyContent: "space-between",
708719
alignItems: "center",
709720
marginTop: "auto",
710-
paddingTop: "8px",
721+
paddingTop: "2px",
711722
}}>
712723
<div
713724
style={{

webview-ui/src/components/settings/ApiOptions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage }: ApiOptionsProps) =
563563
)}
564564

565565
{selectedProvider === "openai" && (
566-
<div>
566+
<div style={{ display: "flex", flexDirection: "column", rowGap: "5px" }}>
567567
<VSCodeTextField
568568
value={apiConfiguration?.openAiBaseUrl || ""}
569569
style={{ width: "100%" }}

0 commit comments

Comments
 (0)