CodeMirror 6: Possible to Stylize Selection?

Hey all,

Really excited to see a new version of CodeMirror in beta! I’m transitioning my use of it to the latest version and noticed a stylistic difference:


CodeMirror 5


CodeMirror 6

Is it possible to make this selection more “rectangular” so to speak? Like in CodeMirror 5?

The new version relies on the native browser selection, and thus has less control over the way the selection is drawn. It should be possible to write a plugin that hides the native selection and draws a CodeMirror-5-style backdrop element instead, but I’m not sure when/if someone will tackle that.

Thanks for the quick response and for CodeMirror in general. That makes a lot of sense. The plugin is something I’ll look into further.

When you have multiple selections, secondary selections are maintained and styled by CodeMirror. Maybe it is a good start to its appearance as if all selection are secondary selections.

2 Likes