Skip to content

fix(webui): send edited user message on Enter, keep Shift+Enter as newline#615

Merged
pancacake merged 1 commit into
HKUDS:devfrom
FourWindff:fix/edit-message-enter-send
Jul 18, 2026
Merged

fix(webui): send edited user message on Enter, keep Shift+Enter as newline#615
pancacake merged 1 commit into
HKUDS:devfrom
FourWindff:fix/edit-message-enter-send

Conversation

@FourWindff

@FourWindff FourWindff commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Description

When a user clicks the Edit button on a sent message, the inline <textarea> previously only submitted on Ctrl/Cmd + Enter. As a result, both Enter and Shift + Enter inserted a newline, which is inconsistent with the bottom composer input.

This change makes the edit textarea use the same shouldSubmitOnEnter() helper as the composer:

  • Enter submits the edited message.
  • Shift + Enter inserts a newline (default textarea behavior).
  • Esc cancels editing (unchanged).
  • Ctrl/Cmd + Enter still submits as a fallback.
  • onCompositionStart / onCompositionEnd guards prevent accidental submission while an IME composition (e.g. Chinese/Japanese input) is active.

The affected component is UserMessage in web/components/chat/home/ChatMessages.tsx.

Module(s) Affected

  • agents
  • api
  • config
  • core
  • knowledge
  • logging
  • services
  • tools
  • utils
  • web (Frontend)
  • docs (Documentation)
  • scripts
  • tests
  • Other: ...

Checklist

  • I have read and followed the contribution guidelines.
  • My code follows the project's coding standards.
  • I have run pre-commit run --all-files and fixed any issues.
  • I have added relevant tests for my changes.
  • I have updated the documentation (if necessary).
  • My changes do not introduce any new security vulnerabilities.

Additional Notes

  • Verified with npx eslint components/chat/home/ChatMessages.tsx (no errors) and npx tsc --noEmit (no type errors).
  • No new tests were added because this is a small keyboard-interaction fix that mirrors existing composer behavior.
  • pre-commit run --all-files triggered the prettier hook, which reformatted a number of existing files (e.g., web/components/chat/home/ChatMessages.tsx, web/components/memory/MemorySection.tsx, etc.). These formatting changes are auto-fixes applied by prettier to legacy code and are not caused by the functional changes in this PR.

…wline

The message edit textarea previously only submitted on Ctrl/Cmd+Enter,
so both Enter and Shift+Enter inserted newlines. Align it with the
composer behavior: Enter submits, Shift+Enter inserts a newline. Also
guard against IME composition to avoid accidental submissions while
selecting candidates.

Co-Authored-By: Claude <noreply@anthropic.com>
@FourWindff FourWindff changed the title fix(webui): send edited user message on Enter, keep Shift+Enter as ne… fix(webui): send edited user message on Enter, keep Shift+Enter as newline Jul 9, 2026
@pancacake
pancacake merged commit d344f95 into HKUDS:dev Jul 18, 2026
pancacake added a commit that referenced this pull request Jul 18, 2026
…mmetric scrollbar gutter

Follow-up to #615/#608/#634: the isComposingRef + composition-handler
trio duplicated across five textareas (ComposerInput,
SimpleComposerInput, ChatMessages edit, BookChatPanel, PartnerComposer)
becomes one useImeComposing() hook; the citation-anchor fallback chain
+ <details> auto-open duplicated in both markdown renderers moves to
lib/markdown-anchors.ts; and the chat scrollport reserves the
scrollbar gutter on both edges so the message column centers on the
same axis as header and composer on classic-scrollbar platforms.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@FourWindff
FourWindff deleted the fix/edit-message-enter-send branch July 19, 2026 04:08
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