#1693·dev

lineWrapping: clicking past end of trailing wrapped segment places cursor on previous visual line

Author: jscaltretoCreated Apr 14, 2026Updated Apr 15, 2026

Describe the issue

When EditorView.lineWrapping is enabled and a line wraps across multiple visual lines, clicking in the horizontal whitespace after the last character on the trailing visual line places the cursor at the equivalent x-position on the visual line above, rather than at the end of the logical line.

Expected: the cursor lands at the end of the line (after the last character of the trailing wrapped segment), matching what the user clicked near.

Actual: the cursor lands mid-line on the previous visual row. Typing then inserts in the wrong place, which is jarring.

Browser and platform

Firefox 149.0 on Linux

Reproduction link

https://codemirror.net/try/#c=aW1wb3J0IHttaW5pbWFsU2V0dXAsIEVkaXRvclZpZXd9IGZyb20gImNvZGVtaXJyb3IiCgpuZXcgRWRpdG9yVmlldyh7CiAgZG9jOiAiVEhJUyBMSU5FIElTIExPTkcuIFRISVMgTElORSBJUyBMT05HLiBUSElTIExJTkUgSVMgTE9ORy4gVEhJUyBMSU5FIElTIExPTkcuIFRISVMgTElORSBJUyBMT05HLiBUSElTIExJTkUgSVMgTE9ORy4gVEhJUyBMSU5FIElTIExPTkcuIFRISVMgTElORSBJUyBMT05HLiBUSElTIExJTkUgSVMgTE9ORy4gVEhJUyBMSU5FIElTIExPTkcuIFRISVMgTElORSBJUyBMT05HLiBUSElTIExJTkUgSVMgTE9ORy4gVEhJUyBMSU5FIElTIExPTkcuIFRISVMgTElORSBJUyBMT05HLiBUSElTIExJTkUgSVMgTE9ORy5cblxuQSBOZXcgTGluZS4iLAogIGV4dGVuc2lvbnM6IFsKICAgIEVkaXRvclZpZXcubGluZVdyYXBwaW5nCiAgXSwKICBwYXJlbnQ6IGRvY3VtZW50LmJvZHkKfSkK