codemirror / dev

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

Selection doesn't drag vertically when text is too long horizontally #1407

Closed nooblyf closed 4 months ago

nooblyf commented 4 months ago

Describe the issue

I've noticed this happening only when the text is both vertically and horizontally scrollable

When i select the text and move the mouse up outside the code block the selection should be dragging the selection up? like it does when i move outside horizontally at 00:18

I don't know if i'm explaining this right, here's a screen recording

https://github.com/user-attachments/assets/22bd2828-e90d-4931-b3b2-9bbed7621492

I've tried this in Safari, Chrome and Firefox

Browser and platform

chrome, macOS

Reproduction link

https://codemirror.net/try/?c=aW1wb3J0IHtNZXJnZVZpZXd9IGZyb20gIkBjb2RlbWlycm9yL21lcmdlIgppbXBvcnQge0VkaXRvclZpZXcsIGJhc2ljU2V0dXB9IGZyb20gImNvZGVtaXJyb3IiCmltcG9ydCB7RWRpdG9yU3RhdGV9IGZyb20gIkBjb2RlbWlycm9yL3N0YXRlIgoKbGV0IGRvY0EgPSBgCiAgICBbCiAgICAgIHsKICAgICJpZCI6IDEsCiAgICAidGl0bGUiOiAiSGlzIG1vdGhlciBoYWQgYWx3YXlzIHRhdWdodCBoaW0iLAogICAgImJvZHkiOiAiSGlzIG1vdGhlciBoYWQgYWx3YXlzIHRhdWdodCBoaW0gbm90IHRvIGV2ZXIgdGhpbmsgb2YgaGltc2VsZiBhcyBiZXR0ZXIgdGhhbiBvdGhlcnMuIEhlJ2QgdHJpZWQgdG8gbGl2ZSBieSB0aGlzIG1vdHRvLiBIZSBuZXZlciBsb29rZWQgZG93biBvbiB0aG9zZSB3aG8gd2VyZSBsZXNzIGZvcnR1bmF0ZSBvciB3aG8gaGFkIGxlc3MgbW9uZXkgdGhhbiBoaW0uIEJ1dCB0aGUgc3R1cGlkaXR5IG9mIHRoZSBncm91cCBvZiBwZW9wbGUgaGUgd2FzIHRhbGtpbmcgdG8gbWFkZSBoaW0gY2hhbmdlIGhpcyBtaW5kLiIsCiAgICAidGFncyI6IFsKICAgICAgImhpc3Rvcn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gICAgImNyaW1lIgogICAgXSwKICAgICJyZWFjdGlvbnMiOiB7CiAgICAgICJsaWtlcyI6IDEyNywKICAgICAgImRpc2xpa2VzIjogMjYKICAgIH0sCiAgICAidmlld3MiOiAxNjgsCiAgICAidXNlcklkIjogNzAKICB9LAogIHsKICAgICJpZCI6IDgsCiAgICAidGl0bGUiOiAiT25lIGNhbiBjb29rIG9uIGFuZCB3aXRoIGFuIG9wZW4gZmlyZS4iLAogICAgImJvZHkiOiAiT25lIGNhbiBjb29rIG9uIGFuZCB3aXRoIGFuIG9wZW4gZmlyZS4gVGhlc2UgYXJlIHNvbWUgb2YgdGhlIHdheXMgdG8gY29vayB3aXRoIGZpcmUgb3V0c2lkZS4gQ29va2luZyBtZWF0IHVzaW5nIGEgc3BpdCBpcyBhIGdyZWF0IHdheSB0byBldmVubHkgY29vayBtZWF0LiBJbiBvcmRlciB0byBrZWVwIG1lYXQgZnJvbSBidXJuaW5nLCBpdCdzIGJlc3QgdG8gc2xvd2x5IHJvdGF0ZSBpdC4iLAogICAgInRhZ3MiOiBbCiAgICAgICJhbWVyaWNhbiIsCiAgICAgICJlbmdsaXNoIgogICAgXSwKICAgICJyZWFjdGlvbnMiOiB7CiAgICAgICJsaWtlcyI6IDEyNzEsCiAgICAgICJkaXNsaWtlcyI6IDM2CiAgICB9LAogICAgInZpZXdzIjogMjExNiwKICAgICJ1c2VySWQiOiA2NwogIH0KICAgIF0KICBgOwoKCm5ldyBNZXJnZVZpZXcoewogIGE6IHsKICAgIGRvYzogZG9jQSwKICAgIGV4dGVuc2lvbnM6IFtdCiAgfSwKICBiOiB7CiAgICBkb2M6IGRvY0IsCiAgICBleHRlbnNpb25zOiBbXQogIH0sCiAgcGFyZW50OiBkb2N1bWVudC5ib2R5Cn0pOw==

marijnh commented 4 months ago

Thanks for the report. Attached patch should help.

nooblyf commented 4 months ago

Thanks for the quick fix!