Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect highlight of block widgets with drawSelection + lineWrapping extensions #1373

Closed
Corb3nik opened this issue Apr 25, 2024 · 1 comment

Comments

@Corb3nik
Copy link

Describe the issue

Hello 👋

The drawSelection extension highlights the wrong areas when the cursor is near a block widget. This only happens when the EditorView.lineWrapping extension is enabled.

Some examples of incorrect highlights:

Screen.Recording.2024-04-25.at.2.07.55.PM.mov

I was able to reproduce this issue on:

  • Firefox (macOS)
  • Safari (macOS)
  • Chrome (macOS)

Browser and platform

No response

Reproduction link

https://codemirror.net/try/?c=aW1wb3J0IHttaW5pbWFsU2V0dXB9IGZyb20gImNvZGVtaXJyb3IiCmltcG9ydCB7CiAgUmFuZ2VTZXRCdWlsZGVyLAogIFN0YXRlRmllbGQsCn0gZnJvbSAiQGNvZGVtaXJyb3Ivc3RhdGUiOwppbXBvcnQgewogIERlY29yYXRpb24sCiAgRWRpdG9yVmlldywKICBXaWRnZXRUeXBlLAogIGRyYXdTZWxlY3Rpb24KfSBmcm9tICJAY29kZW1pcnJvci92aWV3IjsKCmNsYXNzIE5ld2xpbmVXaWRnZXQgZXh0ZW5kcyBXaWRnZXRUeXBlIHsKICB0b0RPTSgpIHsKICAgIGNvbnN0IGRpdiA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoImRpdiIpOwogICAgZGl2LnRleHRDb250ZW50ID0gIi0tLS0tLS0tLS0tIjsKICAgIHJldHVybiBkaXY7CiAgfQp9Cgpjb25zdCBnZXREZWNvcmF0aW9ucyA9ICgpID0+IHsKICBjb25zdCBidWlsZGVyID0gbmV3IFJhbmdlU2V0QnVpbGRlcigpOwogIGNvbnN0IGRlY29yYXRpb24gPSBEZWNvcmF0aW9uLndpZGdldCh7CiAgICB3aWRnZXQ6IG5ldyBOZXdsaW5lV2lkZ2V0KCksCiAgICBibG9jazogdHJ1ZSwKICB9KTsKCiAgYnVpbGRlci5hZGQoMSwgMSwgZGVjb3JhdGlvbik7CiAgYnVpbGRlci5hZGQoOCwgOCwgZGVjb3JhdGlvbik7CiAgcmV0dXJuIGJ1aWxkZXIuZmluaXNoKCk7Cn07Cgpjb25zdCBmaWVsZCA9IFN0YXRlRmllbGQuZGVmaW5lKHsKICBjcmVhdGUoKSB7CiAgICByZXR1cm4gZ2V0RGVjb3JhdGlvbnMoKTsKICB9LAogIHVwZGF0ZShkZWNvcmF0aW9ucykgeyAKICAgIHJldHVybiBkZWNvcmF0aW9ucyAKICB9LAogIHByb3ZpZGU6IChmKSA9PiBFZGl0b3JWaWV3LmRlY29yYXRpb25zLmZyb20oZiksCn0pOwoKbmV3IEVkaXRvclZpZXcoewogIGRvYzogJ3siQSI6IkIifScsCiAgZXh0ZW5zaW9uczogW21pbmltYWxTZXR1cCwKICAgICAgICAgICAgICBmaWVsZCwKICAgICAgICAgICAgICBFZGl0b3JWaWV3LmxpbmVXcmFwcGluZywKICAgICAgICAgICAgICBkcmF3U2VsZWN0aW9uKCldLAogIHBhcmVudDogZG9jdW1lbnQuYm9keQp9KQo=

@marijnh
Copy link
Member

marijnh commented Apr 27, 2024

Attached patch should improve this.

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

No branches or pull requests

2 participants