Skip to content

[Bug]: Shift+Enter in chat composer moves caret to start of text instead of inserting newline #1492

Description

@SamuelThornburg

Version: OpenClaw Companion 2026.9.4 (3c43751), Windows x64. Code path unchanged on main @ a2c4647. Gateway 2026.9.5.

Steps

  1. Open chat in the companion app.
  2. Type hello world, leave the caret at the end.
  3. Press Shift+Enter.

Expected

A newline is inserted at the caret and the caret moves to the new line (as in the web Control UI).

Actual

The caret jumps to position 0, above/before the existing text.

Analysis (from reading the source; not debugged live)

src/OpenClaw.Tray.WinUI/Chat/ReactorChatComposer.cs (~L480–566) uses AcceptsReturn(false) and handles Shift+Enter manually in OnKeyDown: it sets args.Handled = true, calls vm.SetDraft(current[..start] + "\n" + current[end..]), then sets textBox.SelectionStart = start + 1.

ChatComposerViewModel.SetDraft is enqueued via Mutate/EnqueueMutation, so the selection is set against the stale text. When the queued draft re-renders, TextBox.Text is replaced wholesale and WinUI resets the selection to 0. WinUI's \n → \r normalization may also make the read-back text never equal the draft, causing an extra re-sync.

Introduced with the chat composer rewrite (#1055 / #1098).

Suggested fix

Use AcceptsReturn(true) and only intercept unmodified Enter (set Handled, call Send()), letting the TextBox insert newlines natively. Alternatively, defer caret placement until after the draft commits and compare drafts with normalized line endings.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal priority bug or improvement with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:ux-frictionUser-facing flow adds avoidable confusion or support burden without fully blocking progress.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.no-staleExempts this issue from stale automation.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions