summaryrefslogtreecommitdiff
path: root/extension/react-app/src/components/ComboBox.tsx
diff options
context:
space:
mode:
authorNate Sesti <sestinj@gmail.com>2023-07-14 13:45:10 -0700
committerNate Sesti <sestinj@gmail.com>2023-07-14 13:45:10 -0700
commitf0b2597895920b7d714b53f2d70a3a5858f89d42 (patch)
treedf3e5d44b40e65a6853f2922f4cd7a8a76715e10 /extension/react-app/src/components/ComboBox.tsx
parenta16101b49950fba146e8627ffbce3a34e61bb061 (diff)
downloadsncontinue-f0b2597895920b7d714b53f2d70a3a5858f89d42.tar.gz
sncontinue-f0b2597895920b7d714b53f2d70a3a5858f89d42.tar.bz2
sncontinue-f0b2597895920b7d714b53f2d70a3a5858f89d42.zip
insidious client_state vs application_state err
Diffstat (limited to 'extension/react-app/src/components/ComboBox.tsx')
-rw-r--r--extension/react-app/src/components/ComboBox.tsx9
1 files changed, 8 insertions, 1 deletions
diff --git a/extension/react-app/src/components/ComboBox.tsx b/extension/react-app/src/components/ComboBox.tsx
index 5d9b5109..754c9445 100644
--- a/extension/react-app/src/components/ComboBox.tsx
+++ b/extension/react-app/src/components/ComboBox.tsx
@@ -169,6 +169,7 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => {
useImperativeHandle(ref, () => downshiftProps, [downshiftProps]);
const [metaKeyPressed, setMetaKeyPressed] = useState(false);
+ const [focused, setFocused] = useState(false);
useEffect(() => {
const handleKeyDown = (e: KeyboardEvent) => {
if (e.key === "Meta") {
@@ -298,7 +299,11 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => {
// setShowContextDropdown(target.value.endsWith("@"));
},
+ onFocus: (e) => {
+ setFocused(true);
+ },
onBlur: (e) => {
+ setFocused(false);
postVscMessage("blurContinueInput", {});
},
onKeyDown: (event) => {
@@ -374,7 +379,9 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => {
</div>
{highlightedCodeSections.length === 0 &&
(downshiftProps.inputValue?.startsWith("/edit") ||
- (metaKeyPressed && downshiftProps.inputValue?.length > 0)) && (
+ (focused &&
+ metaKeyPressed &&
+ downshiftProps.inputValue?.length > 0)) && (
<div className="text-trueGray-400 pr-4 text-xs text-right">
Inserting at cursor
</div>