Skip to content

Shift+Enter submits prompt instead of inserting newline #30544

Closed

Description

@ahruslan17

Description

Pressing Shift+Enter in the terminal UI prompt submits the prompt instead of inserting a newline.

The default keybindings list Shift+Return as an input newline shortcut, so this breaks multiline prompt entry for terminals that report Shift+Enter as Shift+Return.

Plugins

None

OpenCode version

dev branch

Steps to reproduce

  1. Open the OpenCode terminal UI.
  2. Type text into the prompt.
  3. Press Shift+Enter.

Expected behavior

A newline is inserted into the prompt.

Actual behavior

The prompt is submitted.

Screenshot and/or share link

N/A

Operating System

Linux

Terminal

Any terminal that sends Shift+Enter as Shift+Return

Activity

  1. github-actions commented on Jun 3, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    For keybind-related issues, please also check our pinned keybinds documentation: #4997

  2. shaoer-dev commented on Jun 3, 2026

    @shaoer-dev

    This is probably happening because your terminal is actually sending a newline to opencode when you press shift+enter. Open a new terminal and run cat -v and then press shift+enter. If you see a blank line entered then your terminal is actually sending a newline to opencode and opencode never sees the shift+enter. When I do this I see ^[[27;2;13~ printed to the console.

  3. simonklee commented on Jun 5, 2026

    @simonklee
    Member
  4. furai commented on Jun 18, 2026

    @furai
    Contributor

    It seems that also tmux is preventing shift+enter from being passed to opencode. In the end I'm just using ctrl+j.

  5. shaoer-dev commented on Jun 18, 2026

    @shaoer-dev

    I had the same issue and fixed it by adding this line to my .tmux.conf file: bind-key -n S-Enter send-keys Escape "[13;2u". Per the comment linked above, this is recognized as a shift+enter sequence by opencode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions