Bug
After pasting multi-line text into the prompt input, the cursor lands in the middle of the pasted text instead of at the end.
Root Cause
document.execCommand('insertText') creates <div> block elements for multi-line text. getCursorPosition() doesn't count implicit newlines at block boundaries, but parseFromDOM() does. This cursor/text mismatch causes the cursor to be positioned incorrectly after the editor re-renders.
Steps to Reproduce
- Copy multi-line text
- Paste into the prompt input
- Cursor lands in the middle instead of at the end