Skip to content

Commit 7a39cd6

Browse files
oleg kusovoleg kusov
authored andcommitted
fix: do not touch acceptInput
1 parent 75699dc commit 7a39cd6

File tree

4 files changed

+8
-11
lines changed

4 files changed

+8
-11
lines changed

src/core/Cline.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ export class Cline extends EventEmitter<ClineEvents> {
405405
if (!provider) {
406406
throw new Error("[Cline.ts ask] Cannot wait for input, provider reference lost.")
407407
}
408-
await provider.postMessageToWebview({ type: "acceptInput" })
408+
await provider.postMessageToWebview({ type: "enableChatInput" }) // <<< Use the new dedicated message type
409409

410410
// Wait for handleWebviewAskResponse to set this.askResponse
411411
await pWaitFor(() => this.askResponse !== undefined, { interval: 100 })

src/shared/ExtensionMessage.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ export interface ExtensionMessage {
6767
| "toggleApiConfigPin"
6868
| "acceptInput"
6969
| "setHistoryPreviewCollapsed"
70+
| "enableChatInput"
7071
text?: string
7172
action?:
7273
| "chatButtonClicked"

webview-ui/src/App.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,11 @@ const App = () => {
7878
}
7979

8080
if (message.type === "acceptInput") {
81-
console.log("[App.tsx] Received 'acceptInput' message from backend.")
81+
chatViewRef.current?.acceptInput()
82+
}
83+
84+
if (message.type === "enableChatInput") {
8285
if (chatViewRef.current) {
83-
console.log("[App.tsx] Calling chatViewRef.current.enableChatInput().")
8486
chatViewRef.current?.enableChatInput()
8587
} else {
8688
console.error("[App.tsx] chatViewRef is null when trying to call enableChatInput.")

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

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export interface ChatViewProps {
4747
}
4848

4949
export interface ChatViewRef {
50-
// acceptInput: () => void // We keep this for now in case it's used elsewhere, but comment it out
50+
acceptInput: () => void // We keep this for now in case it's used elsewhere, but comment it out
5151
enableChatInput: () => void // Add the new function signature
5252
}
5353

@@ -1229,25 +1229,19 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
12291229
}, [handleKeyDown])
12301230

12311231
useImperativeHandle(ref, () => ({
1232-
// Keep the old acceptInput logic for now, just in case
12331232
acceptInput: () => {
12341233
if (enableButtons && primaryButtonText) {
12351234
handlePrimaryButtonClick(inputValue, selectedImages)
12361235
} else if (!textAreaDisabled && (inputValue.trim() || selectedImages.length > 0)) {
12371236
handleSendMessage(inputValue, selectedImages)
12381237
}
12391238
},
1240-
// --- ADD THE NEW FUNCTION ---
12411239
enableChatInput: () => {
12421240
console.log("[ChatView.tsx] enableChatInput() called.")
1243-
setTextAreaDisabled((prevState) => {
1244-
console.log(`[ChatView.tsx] Setting textAreaDisabled from ${prevState} to false via enableChatInput.`)
1245-
return false
1246-
})
1241+
setTextAreaDisabled(false)
12471242
console.log("[ChatView.tsx] Focusing text area via enableChatInput.")
12481243
textAreaRef.current?.focus()
12491244
},
1250-
// --- END NEW FUNCTION ---
12511245
}))
12521246

12531247
return (

0 commit comments

Comments
 (0)