nanocoder icon indicating copy to clipboard operation
nanocoder copied to clipboard

[Bug] Shift+Enter scrambles a multi-line message instead of adding a line

Open addyCooks opened this issue 2 months ago • 1 comments

Description

Shift+Enter is the multiline shortcut most modern terminals actually send (kitty, WezTerm, Ghostty, iTerm2 in CSI-u mode) but it corrupts the message instead of adding a line break. Ctrl+J, the other documented multiline shortcut, works correctly because it takes a different, cursor-aware code path.

Parent: #907

Steps to Reproduce

  1. In the composer, type one, press Shift+Enter, type two, press Shift+Enter, type three.
  2. Submit the message.

Expected Behavior

A three-line message: one, two, three.

Actual Behavior

The words fuse onto one line with stray trailing newlines submitted as onetwothree\n\n.

Recording

Image

Root Cause

source/components/user-input.tsx:863-867 — updateInput(input + '\n') always appends the newline at the END of the string regardless of cursor position, and the TextInput cursor is never moved to match. Each subsequent word gets typed at the stale cursor position instead of after the newline.

Suggested Fix

Route Shift+Enter through the same cursor-aware insert Ctrl+J already uses.

Additional Context

  • [x] I have searched existing issues to ensure this is not a duplicate
  • [x] I can reproduce this issue consistently
  • [x] This issue occurs on the latest main

addyCooks avatar Sep 15 '26 18:09 addyCooks

Hey @akramcodez ! I’d like to work on this one could you assign it to me?

addyCooks avatar Sep 15 '26 18:09 addyCooks