codemirror / dev

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

Hotkey Shift+Enter doesn't provide new line anymore #1447

Closed St1ggy closed 1 month ago

St1ggy commented 1 month ago

Describe the issue

I used to use Shift+Enter to wrap a line while preserving formatting, but this behavior seems to be missing in the current version of @codemirror/view. Is this a bug or is it intended? Why isn't this mentioned in changelog?

Browser and platform

any OS, any browsers

Reproduction link

https://codemirror.net/try/

marijnh commented 1 month ago

What does preserving formatting mean, in a code editor? CodeMirror 6 hasn't ever had a special keybinding for shift-enter.

St1ggy commented 1 month ago

But it does work in the version 6.26.3 and it's broken in the current version

marijnh commented 1 month ago

It was never intentionally bound to anything. I guess, despite saying "any OS, any browsers", you're seeing this on Chrome or other Blink-based browsers, where recent version of CodeMirror will no longer support the browser's native contentEditable behaviors.

Attached patch binds Shift-Enter to the same command as Enter. Since this was never an intentional feature, I don't consider anything broken here. You are free to bind it to something else if that works better for you.