Bug Description
When submitting a prompt with pasted content after typing CJK characters (Korean, Chinese, Japanese), the submitted message shows literal [Pasted text]\ instead of the actual pasted content.
Steps to Reproduce
- Open opencode TUI
- Type some Korean/Chinese/Japanese characters in the prompt
- Paste some text after the CJK characters
- Submit the prompt
- Observe that the submitted message shows [Pasted text]\ literal instead of the actual pasted content
Root Cause
In \submitInner(), extmark \start/\�nd\ are display-width offsets (visual columns), not JS string indices. \slice()\ expects character indices. For CJK characters (visual width 2, string length 1), these diverge, causing \slice()\ to cut at wrong positions.
Environment
- OS: Windows 11
- Terminal: Windows Terminal
- opencode version: dev branch (latest)
Bug Description
When submitting a prompt with pasted content after typing CJK characters (Korean, Chinese, Japanese), the submitted message shows literal [Pasted text]\ instead of the actual pasted content.
Steps to Reproduce
Root Cause
In \submitInner(), extmark \start/\�nd\ are display-width offsets (visual columns), not JS string indices. \slice()\ expects character indices. For CJK characters (visual width 2, string length 1), these diverge, causing \slice()\ to cut at wrong positions.
Environment