Visual hints for lineWrapping


I’ve managed to turn on linewrapping with

EditorState.create({doc: text, extensions: [...,  EditorView.lineWrapping,...]});

Is there a way to add a visual hint that the line has been wrapped? (e.g., like a hyphen does for normal text – Emacs will add a little ⤶ symbol in the margin, for instance)

BTW, I also seem to get slightly better results (avoids breaking right after indentation) by adding word-break: break-all; (though this may be a less ideal default for Asian languages).

If you have line numbers turned on, you only get a number next to the start of an actual line. There’s no support for further indicators currently.

Feel free to locally style with break-all, but I don’t think that’s a good default.

@marijn Would it make sense for wrapped lines to have the same indentation level as the previous line? Old codemirror did that, also CodeMirror: Indented wrapped line demo. Also VSCode and Sublime do this.

It’s probably possible to create an extension that does that, but I think it’s too magical to be the default behavior.

1 Like