Skip to content

fix(quote-block): Shift+Enter inserts a newline plus the "> " prefix - #4299

Merged
mstomar125 merged 2 commits into
mainfrom
issue-4286-quote-shift-enter
Nov 18, 2026
Merged

mstomar125 merged 2 commits into
mainfrom
issue-4286-quote-shift-enter

Conversation

@mstomar125

Copy link
Copy Markdown
Contributor

Refs #4286

Per the ruling on #4286 (decision: a quote block stores its > prefix on every line), Shift+Enter in a quote block now inserts \n> with the caret after the prefix, matching how Enter inherits the prefix. It used to insert a bare newline.

  • quote-block-node.svelte: Shift+Enter cancels the browser default, inserts via the new insertQuoteLineBreak, sets the caret, and fires an input event so the controller picks up the change. Removed the pending-cursor-adjustment state and the comments describing the bare newline.
  • types/quote-block-node.ts: pure insertQuoteLineBreak(value, start, end); replaces a selection, and a caret inside an existing >/> prefix is moved past it so the prefix is never split.
  • Display strip and markdown round trip unchanged (lines without a prefix still render; no Rust change needed, the markdown code stores quote content verbatim).

Tests: new quote-block-shift-enter.test.ts (component-level with a textarea BaseNode fixture, plus helper edge cases: single line, mid-line, empty > , selection, caret in prefix, unprefixed line, empty content, plain Enter ignored). Each was mutation-checked. test:changed passes.

🤖 Generated with Claude Code

mstomar125 and others added 2 commits November 18, 2026 09:29
A quote block stores its "> " prefix on every line, but Shift+Enter inserted
a bare newline, leaving the new line without the prefix. The key handler now
cancels the default, inserts "\n> " (replacing any selection, never splitting
an existing prefix), puts the caret after the new prefix and notifies the
controller through an input event. Removes the cursor-adjustment state that
assumed another component would add the prefix.

Refs #4286

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…IME and handled events

The prefix regex matched across a newline for a bare '>' line, moving the caret into the next line. Use /^> ?/. Also ignore Shift+Enter while composing or when already default-prevented.

Refs #4286

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
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.

1 participant