Skip to content

fix(web): preserve newlines in user chat messages#449

Merged
pancacake merged 1 commit into
HKUDS:devfrom
kagura-agent:fix/user-message-newline-444
May 8, 2026
Merged

fix(web): preserve newlines in user chat messages#449
pancacake merged 1 commit into
HKUDS:devfrom
kagura-agent:fix/user-message-newline-444

Conversation

@kagura-agent

Copy link
Copy Markdown
Contributor

Summary

Fixes #444 — user messages containing newlines (entered via Shift+Enter) are displayed without line breaks, making multi-line content unreadable.

Root Cause

The user message content in ChatMessages.tsx is rendered inside a plain <div> which collapses whitespace by default (CSS white-space: normal).

Fix

Add the Tailwind whitespace-pre-wrap class to the content <div> so that newline characters in the message are preserved during rendering while still wrapping at the container edge.

Changes

  • web/components/chat/home/ChatMessages.tsx: Add className="whitespace-pre-wrap" to the user message content div (line 464)

Testing

  • Verified that the <textarea> input correctly preserves newlines (Shift+Enter) in the message data
  • The fix applies standard CSS white-space: pre-wrap which is widely supported and consistent with how the assistant response component already handles multi-line content

Add whitespace-pre-wrap to the user message content div so that
newlines entered via Shift+Enter are rendered correctly instead of
being collapsed into a single line.
@pancacake pancacake merged commit 4733a1a into HKUDS:dev May 8, 2026
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