You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
composer: no live visual feedback for Markdown while typing #516
Typing Markdown syntax in the composer, a leading - for a bullet, backticks around code, gives no visual feedback before you send.
The text just sits there as literal dashes and backticks. #235 (merged) makes Enter continue the same list marker as you type, but it doesn't style anything: the marker never becomes a bullet glyph, and wrapped text never becomes a code chip, until after the message is sent and goes through the chat renderer (which already handles both correctly: ul/ol get list-disc/list-decimal with indentation, fenced and inline code get CodeBlock/ui-code-chip).
What you'd like
Lightweight live feedback as you type, in the composer itself: bullet/number lines get indentation and a marker glyph, backtick-wrapped text gets a monospace/code-chip treatment, the way Notion or Linear's composer does, without needing to send the message first.
Anything else
Scope note: this is not a small follow-up to #235. That PR only changed key handling in a plain text input (continue the marker, Tab to nest). Live styling-as-you-type means the composer needs to become a decorated contenteditable (or equivalent), not a plain textarea, a materially bigger change that should be scoped as its own project.
Repro: type - text then a backtick-wrapped word in the composer, neither shows any visual change until sent.
Version: current dev (0.2.40). Platform: macOS, likely all platforms.
@SiddDevZ@ramxcodes I'd like a decision from you before I start: can the composer's <textarea> be replaced with an editor? This issue needs that change, and it would also remove the composer limitations in #518 (#515).
Why the textarea blocks this
MentionTextarea is a transparent <textarea> laid over a mirror <div> that paints the highlights. The mirror only lines up with the caret while every character has exactly the same width in both layers. Live Markdown changes widths:
A list line needs the chat's indent (ps-5) and a bullet or number glyph.
An inline code chip uses a monospace font and padding.
Both push the mirror's text away from the real caret. CSS alone can't fix this. The field itself has to render the styled text.
The same limit is why #518 draws a bot's face over the @ instead of a real chip. Its known issues are listed in that PR. The face can overlap a caret placed just before a mention, it crowds a word typed with no space before it, and it extends past the text's edge at the start of a line.
Proposal: CodeMirror 6 as the composer field
CodeMirror keeps the content as a plain string. What you send is exactly what you typed, and styling is applied on top as decorations.
@codemirror/state and @codemirror/view are already dependencies. apps/artifacts uses them in CodeView.
List lines get the chat's indent and a • or number. The marker characters stay in the text, so the caret and Backspace still work on them.
`code` gets the same ui-code-chip class the chat renderer uses, so nothing shifts when the message is sent. The backticks stay visible, dimmed.
One place to add more inline tokens later: thread refs, links, slash commands and files.
No second layer kept in sync with the text, so the mirror code, MIRROR_BLEED and the Android text-zoom adjustment go away.
Cons and risks
It replaces the field the whole composer is built on. These need retesting:
paste (images to attachments, HTML as plain text)
Enter to send while typing with an IME (Japanese, Chinese)
the send-key setting
auto-height and the 6-line cap
the resize edge and the phone layout
dictation, and apps that write into the field directly
draft restore when switching chats
edit-last-message
focus returning from the find bar
contenteditable behaves differently in WebKit, Chromium and Android WebView. Mobile keyboards, autocorrect and spellcheck need checking on real devices.
About 22 composer test files query textarea. They need a shared helper, so most of the diff will be test changes.
The chat app doesn't load CodeMirror today, so the chat bundle grows by its size.
Suggested rollout
Swap only the chat Composer. BubbleEditor, AskCard and the other textareas stay as they are.
Keep the current textarea behind a flag for one release, so it can be switched back.
Are you OK with replacing the composer's textarea? If yes, is CodeMirror 6 the right choice, or do you prefer another option? Until you decide, #518 keeps the overlay.
Activity
shubhook commentedon Dec 4, 2026
I'm working on this, will open a PR soon
shubhook commentedon Dec 4, 2026
@SiddDevZ @ramxcodes I'd like a decision from you before I start: can the composer's
<textarea>be replaced with an editor? This issue needs that change, and it would also remove the composer limitations in #518 (#515).Why the textarea blocks this
MentionTextareais a transparent<textarea>laid over a mirror<div>that paints the highlights. The mirror only lines up with the caret while every character has exactly the same width in both layers. Live Markdown changes widths:ps-5) and a bullet or number glyph.Both push the mirror's text away from the real caret. CSS alone can't fix this. The field itself has to render the styled text.
The same limit is why #518 draws a bot's face over the
@instead of a real chip. Its known issues are listed in that PR. The face can overlap a caret placed just before a mention, it crowds a word typed with no space before it, and it extends past the text's edge at the start of a line.Proposal: CodeMirror 6 as the composer field
CodeMirror keeps the content as a plain string. What you send is exactly what you typed, and styling is applied on top as decorations.
@codemirror/stateand@codemirror/vieware already dependencies.apps/artifactsuses them inCodeView.•or number. The marker characters stay in the text, so the caret and Backspace still work on them.`code`gets the sameui-code-chipclass the chat renderer uses, so nothing shifts when the message is sent. The backticks stay visible, dimmed.markdownKeyEdit) carry over unchanged. Only the step that applies the edit changes.value,selectionStart,setSelectionRange,focus), so most ofComposer.tsxstays the same.Options considered
1),*, spacing and code fences in what gets sent.Pros
MIRROR_BLEEDand the Android text-zoom adjustment go away.Cons and risks
textarea. They need a shared helper, so most of the diff will be test changes.Suggested rollout
Composer.BubbleEditor,AskCardand the other textareas stay as they are.Are you OK with replacing the composer's textarea? If yes, is CodeMirror 6 the right choice, or do you prefer another option? Until you decide, #518 keeps the overlay.