Skip to content

fix: pasted text not expanded correctly after CJK input #29711

@xodmd45-ctrl

Description

@xodmd45-ctrl

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

  1. Open opencode TUI
  2. Type some Korean/Chinese/Japanese characters in the prompt
  3. Paste some text after the CJK characters
  4. Submit the prompt
  5. 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)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions