-
Notifications
You must be signed in to change notification settings - Fork 297
[Bug]: Shift+Enter in chat composer moves caret to start of text instead of inserting newline #1492
Copy link
Copy link
Open
Labels
P2Normal priority bug or improvement with limited blast radius.Normal priority bug or improvement with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:ux-frictionUser-facing flow adds avoidable confusion or support burden without fully blocking progress.User-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.Very strong issue quality with high-confidence source-level or clear reproduction.no-staleExempts this issue from stale automation.Exempts this issue from stale automation.
Description
Activity
Metadata
Metadata
Assignees
Labels
P2Normal priority bug or improvement with limited blast radius.Normal priority bug or improvement with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:ux-frictionUser-facing flow adds avoidable confusion or support burden without fully blocking progress.User-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.Very strong issue quality with high-confidence source-level or clear reproduction.no-staleExempts this issue from stale automation.Exempts this issue from stale automation.
Type
Fields
Priority
None yet
Projects
- StatusShow more project fieldsBacklog
Version: OpenClaw Companion 2026.9.4 (3c43751), Windows x64. Code path unchanged on
main@ a2c4647. Gateway 2026.9.5.Steps
hello world, leave the caret at the end.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) usesAcceptsReturn(false)and handles Shift+Enter manually inOnKeyDown: it setsargs.Handled = true, callsvm.SetDraft(current[..start] + "\n" + current[end..]), then setstextBox.SelectionStart = start + 1.ChatComposerViewModel.SetDraftis enqueued viaMutate/EnqueueMutation, so the selection is set against the stale text. When the queued draft re-renders,TextBox.Textis replaced wholesale and WinUI resets the selection to 0. WinUI's\n→\rnormalization 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 (setHandled, callSend()), letting the TextBox insert newlines natively. Alternatively, defer caret placement until after the draft commits and compare drafts with normalized line endings.