diff options
author | Ty Dunn <ty@tydunn.com> | 2023-07-07 17:57:45 -0700 |
---|---|---|
committer | Ty Dunn <ty@tydunn.com> | 2023-07-07 17:57:45 -0700 |
commit | c9c584c3a7d367651c03afdf7a0648720f818e7e (patch) | |
tree | 692d4debd668f2edb9560b003cf7c94d64476616 /extension/react-app | |
parent | b40fa922a573173c049a664746014cae81080ced (diff) | |
parent | 40cea963de77c0fc83729cb8d885d1595f4da3cf (diff) | |
download | sncontinue-c9c584c3a7d367651c03afdf7a0648720f818e7e.tar.gz sncontinue-c9c584c3a7d367651c03afdf7a0648720f818e7e.tar.bz2 sncontinue-c9c584c3a7d367651c03afdf7a0648720f818e7e.zip |
Merge branch 'main' of github.com:continuedev/continue
Diffstat (limited to 'extension/react-app')
-rw-r--r-- | extension/react-app/src/components/ComboBox.tsx | 7 | ||||
-rw-r--r-- | extension/react-app/src/tabs/gui.tsx | 10 |
2 files changed, 8 insertions, 9 deletions
diff --git a/extension/react-app/src/components/ComboBox.tsx b/extension/react-app/src/components/ComboBox.tsx index 4dab8bcd..e6632360 100644 --- a/extension/react-app/src/components/ComboBox.tsx +++ b/extension/react-app/src/components/ComboBox.tsx @@ -293,8 +293,7 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => { event.key === "Enter" && (!downshiftProps.isOpen || items.length === 0) ) { - downshiftProps.setInputValue(""); - const value = event.currentTarget.value; + const value = downshiftProps.inputValue; if (value !== "") { setPositionInHistory(history.length + 1); setHistory([...history, value]); @@ -302,10 +301,6 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => { // Prevent Downshift's default 'Enter' behavior. (event.nativeEvent as any).preventDownshiftDefault = true; - // cmd+enter to /edit - if (event.metaKey) { - event.currentTarget.value = `/edit ${event.currentTarget.value}`; - } if (props.onEnter) props.onEnter(event); } else if (event.key === "Tab" && items.length > 0) { downshiftProps.setInputValue(items[0].name); diff --git a/extension/react-app/src/tabs/gui.tsx b/extension/react-app/src/tabs/gui.tsx index 1ea70dd2..e1ecec9e 100644 --- a/extension/react-app/src/tabs/gui.tsx +++ b/extension/react-app/src/tabs/gui.tsx @@ -217,9 +217,13 @@ function GUI(props: GUIProps) { [client] ); - const onMainTextInput = () => { + const onMainTextInput = (event?: any) => { if (mainTextInputRef.current) { - const input = (mainTextInputRef.current as any).inputValue; + let input = (mainTextInputRef.current as any).inputValue; + // cmd+enter to /edit + if (event?.metaKey) { + input = `/edit ${input}`; + } (mainTextInputRef.current as any).setInputValue(""); if (!client) return; @@ -352,7 +356,7 @@ function GUI(props: GUIProps) { // } ref={mainTextInputRef} onEnter={(e) => { - onMainTextInput(); + onMainTextInput(e); e.stopPropagation(); e.preventDefault(); }} |