Skip to content

fix(cli): support newline fallbacks in OpenTUI chat - #24

Merged
osimuka merged 2 commits into
mainfrom
fix/opentui-multiline-input
Oct 6, 2026
Merged

osimuka merged 2 commits into
mainfrom
fix/opentui-multiline-input

Conversation

@osimuka

@osimuka osimuka commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Summary

In the OpenTUI chat, Shift+Enter submitted the message instead of inserting a newline in terminals that don't report modified Enter keys (macOS Terminal, VS Code integrated terminal). They send Shift+Enter as a plain \r, which is indistinguishable from Enter.

Changes:

  • Add a portable line continuation: ending a line with \ and pressing Enter removes the backslash and inserts a newline (handled in onSubmit).
  • Update the footer hint to list Shift/Option+Enter, Ctrl+J and \+Enter.
  • Extend scripts/test-cli-opentui.mjs to cover \+Enter and Option/Meta+Enter.
  • Document terminal support for Shift+Enter, the fallbacks, and a VS Code keybindings.json snippet that maps Shift+Enter to ESC CR.

Validation

  • npm run typecheck — passed
  • npm run build — passed
  • npm test -- --runInBand — passed (45 suites, 376 tests)
  • node --experimental-ffi scripts/test-cli-opentui.mjs (Node 26.10; Bun unavailable locally for npm run test:cli-opentui) — passed

Checklist

  • Tests added or updated where behavior changed
  • Documentation updated where needed
  • No secrets or generated credentials are included
  • Changes are focused and backward-compatible, or breaking changes are documented

Terminals without modified-key reporting send Shift+Enter as plain Enter.
Add backslash+Enter line continuation, update the help hint, test the
legacy fallbacks, and document terminal-specific newline keys.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@osimuka
osimuka requested a balanced review from Copilot October 6, 2026 14:20
@osimuka osimuka self-assigned this Oct 6, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The fallback can delete an active text selection when its cursor follows a backslash.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Adds portable newline fallbacks for OpenTUI chat across terminals with limited modified-key support.

Changes:

  • Adds \+Enter line continuation.
  • Expands newline shortcut coverage and documentation.
  • Tests backslash and Option/Meta+Enter handling.
File Description
api/​core/​library/​cliOpenTui.ts Implements fallback and updates footer help.
scripts/​test-cli-opentui.mjs Tests newline fallback inputs.
README.md Documents terminal compatibility and VS Code setup.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread api/core/library/cliOpenTui.ts Outdated
Avoid deleting an active selection when Enter is pressed with the cursor
after a backslash, and add a regression test.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The focused implementation matches the documented behavior and includes appropriate regression coverage.

Review effort: Balanced
Findings: None

Resolved since last review (1)

@osimuka
osimuka merged commit 5c14603 into main Oct 6, 2026
5 checks passed
@osimuka
osimuka deleted the fix/opentui-multiline-input branch October 6, 2026 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants