opencode icon indicating copy to clipboard operation
opencode copied to clipboard

tui: Ctrl+Enter does not submit prompt (WSL2, Windows Terminal + tmux)

Open leekokeng opened this issue 2 weeks ago • 3 comments

Summary

Ctrl+Enter does not submit the prompt in the TUI. Pressing it does nothing at all — the message is not sent and no newline is inserted. Enter still works normally.

Environment

  • opencode version: v2.3.0 (latest)
  • OS: Linux 6.18.58.1-microsoft-standard-WSL2 (linux x64)
  • Terminal: Windows Terminal running tmux (TERM_PROGRAM=tmux, TERM=tmux-256color, COLORTERM=truecolor)
  • Shell: /bin/bash
  • Install/channel: latest
  • Active plugins: superpowers, @dietrichgebert/ponytail

Reproduction

  1. Start opencode TUI in WSL2, inside a tmux session running in Windows Terminal.
  2. Type a message in the prompt.
  3. Press Ctrl+Enter.

Expected Behavior

Ctrl+Enter submits the prompt.

Actual Behavior

Nothing happens. The message is not sent and no newline is inserted. Enter submits as expected. Reproduces consistently.

Additional Context

  • Default keybinds, no custom keybind configuration.
  • Possibly related to terminal input encoding: tmux without extended-keys support and/or Windows Terminal may not emit a distinct escape sequence for Ctrl+Enter, but the TUI silently swallowing the key with no effect makes it hard to tell whether the key even reaches opencode. Related existing issues: #50684 (ctrl+return inserts newline when unbound), #59661 (shift+enter in macOS Terminal.app).

leekokeng avatar Nov 18 '26 08:11 leekokeng

Thanks for the detailed report.

First, about what you expected: by default Ctrl+Enter is not a submit key. In the default keybinds, input.submit is return (Enter), and ctrl+return is one of the input.newline keys (shift+return,ctrl+return,alt+return,ctrl+j). See the keybinds docs. If you want Ctrl+Enter to submit, you can rebind it in cli.json.

Still, Ctrl+Enter should at least insert a newline, and you say it does nothing at all. That part may be a bug, and these details would help us narrow it down:

  1. Does the same happen when you run opencode directly in Windows Terminal, outside tmux?
  2. Inside tmux, do Shift+Enter and Ctrl+J insert a newline?
  3. Your tmux version (tmux -V), and your tmux config, or at least the output of tmux show -s | grep -i ext and any terminal-features / extended-keys lines.
  4. Does it still happen with your plugins (superpowers, @dietrichgebert/ponytail) temporarily disabled?
  5. If you can: the bytes tmux receives for Ctrl+Enter. For example, run cat -v in a tmux pane (after starting and quitting OpenCode once) and press Ctrl+Enter.

You can reply here with the details, or edit the issue. If you edit it, please also leave a comment saying you've updated it, so we know when you're done.

Related issues, ordered from most to least likely to be related:

  • #50684: on WSL2 with Windows Terminal, Ctrl+J and Ctrl+Return insert a newline whatever the keybind config says. It has been reproduced for Ctrl+J sent as a raw line-feed byte.
  • #63629: Shift+Enter ignored inside tmux. It was closed after its author did not reply.
  • #1505 and #167: older reports of newline keys not working, the latter in tmux.
  • #4997: the pinned collection of keybind issues, including multiline input with Shift+Enter and Ctrl+Enter.

opencodejr[bot] avatar Nov 18 '26 08:11 opencodejr[bot]

I'd like to work on this. Plan: reproduce on my setup, add a focused fix with a test if the repo already has coverage in this area. Is it still available for an outside PR?

amrsorne avatar Nov 18 '26 10:11 amrsorne

Thanks again for the report. By default Ctrl+Enter inserts a newline and Enter submits, so we waited for details on why Ctrl+Enter does nothing at all in your WSL2 + Windows Terminal + tmux setup. We asked whether it happens outside tmux, whether Shift+Enter or Ctrl+J work, about your tmux extended-keys settings, whether your plugins matter, and what bytes Ctrl+Enter sends. We haven't received those details, so I'm closing this issue for now. Ctrl+J or Shift+Enter may work for newlines in the meantime, and #50684 covers a related Windows Terminal newline-key issue.

If it still happens, reply here with any of those details and the issue will reopen.

opencodejr[bot] avatar Nov 18 '26 14:11 opencodejr[bot]