Skip to content

Conversation

@josephbharrison
Copy link
Contributor

@josephbharrison josephbharrison commented Jan 13, 2026

Summary

Fixes two related issues with newline input in the prompt:

  1. Ctrl+J, Ctrl+Enter, Alt+Enter don't work - The input_newline keybind was defined in config but never used; only Shift+Enter was hardcoded
  2. Shift+Enter intermittently stops working - The IME composing check blocks all Enter-based keybinds when the composing signal gets stuck

Problem

Issue 1: Keybinds not implemented

The config defines input_newline: 'shift+return,ctrl+return,alt+return,ctrl+j' but the code only checked for event.shiftKey && event.key === 'Enter'. This meant Ctrl+J and other alternatives never worked.

Issue 2: IME composing state gets stuck

The IME composing check ran before the newline handler. If the composing signal got stuck in true state (e.g., if compositionend event never fired), all Enter keypresses were ignored.

This manifests as:

  • Newline keybinds work initially
  • At some point they stop working entirely
  • Only deleting the session restores functionality

Solution

  1. Use proper keybind matching - Import parseKeybind/matchKeybind and use the config's input_newline keybind instead of hardcoding
  2. Move newline check before IME check - Newline keybinds are never used for IME input
  3. Reset composing on focus loss - Safety net to prevent stuck state

Testing

  • All existing tests pass (47 keybind tests, 12 app tests)
  • Typecheck passes

…ck state

The IME composing check was running before the Shift+Enter handler, which
caused Shift+Enter to stop working if the composing signal got stuck in
true state (e.g., if compositionend event never fired).

Changes:
- Move Shift+Enter handler before the IME composing check since Shift+Enter
  is never used for IME input and should always insert a newline
- Add safety effect to reset composing state on focus loss, preventing
  stuck state from persisting

This fixes an intermittent bug where Shift+Enter would stop working and
only recover after deleting the session.
@github-actions
Copy link
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

@adamdotdevin adamdotdevin merged commit 66b7a49 into anomalyco:dev Jan 13, 2026
2 checks passed
dl-alexandre pushed a commit to dl-alexandre/opencode that referenced this pull request Jan 13, 2026
fwang pushed a commit that referenced this pull request Jan 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants