mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
fix: Shift+Enter inserts newline instead of sending when Ctrl+Enter mode is enabled
Removes event.shiftKey from the send condition in ChatTextArea when enterBehavior is "newline", so that only Ctrl/Cmd+Enter sends the message. Shift+Enter and plain Enter now both insert newlines as expected. Fixes #10386
This commit is contained in:
parent
137d3f4fd8
commit
08ce747e74
2 changed files with 5 additions and 5 deletions
|
|
@ -491,8 +491,8 @@ export const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
|
|||
// Handle Enter key based on enterBehavior setting
|
||||
if (event.key === "Enter" && !isComposing) {
|
||||
if (enterBehavior === "newline") {
|
||||
// New behavior: Enter = newline, Shift+Enter or Ctrl+Enter = send
|
||||
if (event.shiftKey || event.ctrlKey || event.metaKey) {
|
||||
// New behavior: Enter/Shift+Enter = newline, Ctrl/Cmd+Enter = send
|
||||
if (event.ctrlKey || event.metaKey) {
|
||||
event.preventDefault()
|
||||
resetHistoryNavigation()
|
||||
onSend()
|
||||
|
|
|
|||
|
|
@ -1081,7 +1081,7 @@ describe("ChatTextArea", () => {
|
|||
expect(shiftEnterEvent.defaultPrevented).toBe(false)
|
||||
})
|
||||
|
||||
it("should treat Ctrl/Cmd/Shift+Enter as send and plain Enter as newline in newline mode", () => {
|
||||
it("should treat Ctrl/Cmd+Enter as send and plain Enter/Shift+Enter as newline in newline mode", () => {
|
||||
const onSend = vi.fn()
|
||||
|
||||
;(useExtensionState as ReturnType<typeof vi.fn>).mockReturnValue({
|
||||
|
|
@ -1118,8 +1118,8 @@ describe("ChatTextArea", () => {
|
|||
cancelable: true,
|
||||
})
|
||||
fireEvent(textarea, shiftEnterEvent)
|
||||
expect(onSend).toHaveBeenCalledTimes(2)
|
||||
expect(shiftEnterEvent.defaultPrevented).toBe(true)
|
||||
expect(onSend).toHaveBeenCalledTimes(1) // Shift+Enter should NOT send
|
||||
expect(shiftEnterEvent.defaultPrevented).toBe(false) // Should allow newline
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue