[BUG] chat:newline keybinding submits message when input has text

Status Fixed / completed
Reported on v2.1.49
Maintainer reply None cached
Activity 13 comments · opened Feb 20, 2026 · closed Aug 19, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Remapping enter to chat:newline in ~/.claude/keybindings.json does not fully work when the input contains text.

## Keybindings config

```json
{
"context": "Chat",
"bindings": {
"shift+enter": "chat:submit",
"enter": "chat:newline"
}
}

What Should Happen?

Pressing Enter always inserts a newline, regardless of whether the input is empty or contains text.

Error Messages/Logs

Steps to Reproduce

## Keybindings config

  {                                                                                                                                   
    "context": "Chat",                                                                                                                
    "bindings": {                                                                                                                     
      "shift+enter": "chat:submit",                                                                                                   
      "enter": "chat:newline"                                                                                                         
    }                                                                                                                                 
  }

Expected behavior

Pressing Enter always inserts a newline, regardless of whether the input is empty or contains text.

Actual behavior

  • Empty input: Enter correctly inserts a newline.
  • Input with text: Enter submits the message AND leaves a duplicate copy of the text in the input field (as if attempting both

newline and submit simultaneously).

Claude Model

None

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2.1.49

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

VS Code integrated terminal

Additional Information

Environment

  • macOS (Darwin 24.6.0)
  • Tested in both VS Code integrated terminal and iTerm2 — same behavior in both
  • Claude Code CLI (latest)

Notes

  • Option+Enter (default macOS multiline shortcut) works correctly in all cases
  • The keybinding is being recognized (the duplicate text left in the input suggests partial newline behavior), but submit is not

fully suppressed

View original on GitHub ↗

12 Comments

github-actions[bot] · 6 months ago

Found 1 possible duplicate issue:

  1. https://github.com/anthropics/claude-code/issues/26756

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

ww2283 · 6 months ago

Don't know why that issue got closed, but this is a bug that "enter": "chat:newline" does not work

mixram · 5 months ago

I have the same issue with remapping keys

mattduck · 5 months ago
Input with text: Enter submits the message AND leaves a duplicate copy of the text in the input field (as if attempting both

newline and submit simultaneously)

same bug here on claude 2.1.71 (macos + iterm2)

guppy-jpf · 5 months ago

same on regular macos terminal. this has been broken for weeks.
i had created a keybindings file trying to get it to work when it was first announced, but it never did anything.
now, as of 2.1.72, it makes enter (which still submits anyway) also fail to clear the prompt, so the UI becomes
basically unusable until the entire mess is reverted to the default. the "feature" still isn't documented,
so maybe they think no one will notice if it doesn't work ...

raffishquartan · 5 months ago

Still an issue for me - Windows 11 Home / wezterm 20260117-154428-05343b38

yumaIna · 5 months ago

I'm experiencing the same issue. Enter submits the message even when it's remapped to chat:newline in keybindings.json.

lfu46 · 4 months ago

Same issue here, but even broader — no keybinding works for chat:newline at all.

Tested keybindings.json configs:

  • "alt+enter": "chat:newline" — does not insert newline
  • "option+enter": "chat:newline" — does not insert newline
  • "ctrl+enter": "chat:newline" — does not insert newline

All three submit the message instead of inserting a newline.

Environment:

  • Claude Code 2.1.96
  • macOS Darwin 25.4.0
  • Terminal: default shell (zsh)

Note: the original report mentions "Option+Enter works correctly as the default macOS multiline shortcut" — that is not the case on my setup either. Option+Enter also submits the message.

hi-fox · 4 months ago

Confirm this issue still broken. Why are they closing all the issues and not fxing it?

OliPetry · 4 months ago

Platform: macOS (terminal, not IDE extension)
Version: 2.1.123

Adding another reproduction case. My desired keybinding setup is Enter = newline, Cmd+Enter = submit (the standard pattern in most chat UIs).

keybindings.json:

[
  { "key": "enter", "command": "chat:newline" },
  { "key": "meta+enter", "command": "chat:submit" }
]

Expected: Enter inserts a newline, Cmd+Enter submits.

Actual: Enter correctly inserts a newline, but Cmd+Enter does nothing. The Enter binding appears to be greedy — it captures the keypress regardless of modifiers, so the meta+enter binding never fires. There's no way to submit.

This makes the Enter/Cmd+Enter pattern unusable. The same issue occurs with Shift+Enter as the submit binding.

raffishquartan · 4 months ago

Something worth noting: Shift-Enter doesn't come through many terminals, and it looks like Enter by default. But that is not the problem.

By using cat -v and configuring the terminal you can work avoid this issue. My current configuration is below. Using this I find that Shift+Enter gives me a new line inside a message and Enter submits it (the opposite of what I want, and trying to configure Claude Code the other way around doesn't have any effect on what key submits a message)

My current .claude/keybindings.json:

{
  "$schema": "https://www.schemastore.org/claude-code-keybindings.json",
  "$docs": "https://code.claude.com/docs/en/keybindings",
  "bindings": []
}

The relevant part of my .wezterm.lua:

config.keys = {
  {
    key = 'Enter',
    mods = 'SHIFT',
    action = wezterm.action.SendString '\x1b[13;2u',
  },
}
ww2283 · 3 months ago

still not behave as expect in this issue body as of 2.1.139

Showing cached comments. Read the full discussion on GitHub ↗