codemirror / dev

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

Can't create new lines in Stylus Legacy Mode #1424

Closed shshaw closed 3 months ago

shshaw commented 3 months ago

Describe the issue

When using the Stylus Legacy Mode, hitting "enter" for a new line produces this error.

image

I'd post a reproduction, but I can't seem to get Stylus to load via the @codemirror/language-data package in codemirror.net/try as it produces this error:

Screenshot 2024-08-14 at 9 35 27 AM

Browser and platform

No response

Reproduction link

No response

marijnh commented 3 months ago

This script seems to run fine for me.

shshaw commented 3 months ago

That CodeMirror try example does run and seems to somewhat highlight the Stylus code as expected.

However, the problem does exist there where I cannot type any newline characters with the Return/Enter key. If I paste in code with newlines, that all works as expected, but I still cannot add any.

Other languages work fine.

This is a video of me running that CodeMirror Try example, hitting return in multiple scenarios, and not getting any new lines inserted.

https://github.com/user-attachments/assets/594f4fa1-f395-40bc-a11d-0dff578eafbe

marijnh commented 3 months ago

Ah, I see. It crashes, but on Firefox a new line was created anyway, so I didn't see the issue. On Chrome indeed that prevents enter from doing anything. Attached patch should help.

shshaw commented 3 months ago

That seems to have fixed it. Thanks!