codemirror / dev

Development repository for the CodeMirror editor project
https://codemirror.net/
Other
5.94k stars 376 forks source link

simultaneous use of whitespaces and soft wrapping causes inappropriate behavior #1444

Closed HeilagrFox closed 1 month ago

HeilagrFox commented 1 month ago

I came across a bug in the component: when a line is broken, the displayed spaces are shifted to the distance of the text of the previous line and are superimposed on the text of the new line.

Expected result: line........... .....

Actual result: line........... ...........

I noticed that dots were wrapped by span tag, so they can't be moved to another line as it should be.

image

marijnh commented 1 month ago

Could you share the link to the script you made a screenshot of, so I don't have to type in your code? (See the 'Share' button)

HeilagrFox commented 1 month ago

Link: https://codemirror.net/try/?c=CmltcG9ydCB7YmFzaWNTZXR1cCwgRWRpdG9yVmlld30gZnJvbSAiY29kZW1pcnJvciIKaW1wb3J0IHtqYXZhc2NyaXB0fSBmcm9tICJAY29kZW1pcnJvci9sYW5nLWphdmFzY3JpcHQiCmltcG9ydCB7IGhpZ2hsaWdodFdoaXRlc3BhY2UgYXMgaGlnaGxpZ2h0d2hpdGVzcGFjZVBsdWdpbiB9IGZyb20gIkBjb2RlbWlycm9yL3ZpZXciCmNvbnN0IGRvYyA9IGBleGFtcGxlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYApuZXcgRWRpdG9yVmlldyh7CiAgZG9jLApleHRlbnNpb25zOiBbCiAgCiAgYmFzaWNTZXR1cCwKICBFZGl0b3JWaWV3LmxpbmVXcmFwcGluZywKICBoaWdobGlnaHR3aGl0ZXNwYWNlUGx1Z2luKCksCiAgamF2YXNjcmlwdCgpLApdLApwYXJlbnQ6IGRvY3VtZW50LmJvZHkgfSk=

marijnh commented 1 month ago

Attached patch should resolve this.

HeilagrFox commented 1 month ago

@marijnh Can you please make a new release right now because these changes are really important?) 🙏🙏🙏

marijnh commented 1 month ago

I've tagged @codemirror/view 6.34.0