`drawSelection` highlights whole line on line breaks

I’ve noticed that drawSelection() always extends the selection layer `.cm-selectionBackground` to cover the whole visual line, for each included line break. This deviates from native behavior (at least on my OS) where the selection stops at the line break:

Could this behavior be customized instead?

No, this isn’t customizable. You could try not including drawSelection in your configuration and seeing if you like the native selection better.

This is for the codemirror-helix extensions, which I believe requires drawSelection() to have proper multi-cursor.

I’m not particularly bothered by the defaults, it’s just something I noticed b/c I’m trying to reproduce Helix’s look and feeling as much as possible.

Would it be possible to reimplement drawSelection()? I haven’t checked thoroughly whether it uses some unexposed internals.

Yes, that should absolutely be possible.

1 Like