CodeMirror6 selection match not "merge" when the selection is repeated characters

GIF 2024-12-7 14-33-54

I tried adding outline to the .selectionMatch class:

  ".cm-selectionMatch": {
    outline: `${color.highlight} solid 1px`,
    backgroundColor: 'transparent'
  },

The result looks like CodeMirror

  1. considers contiguous matches as merged so it doesn’t merge them (when selection changes from o to oo, there should be 3 oo highlights)
  2. the opposite, when some maches need splitting it doesn’t split them (when selection changes from oo to o, there’re 2 oo highlights left, expects 0).

Comparing with Sublime Text:

GIF 2024-12-7 14-43-19
image

That was a bug in the way decorations were compared. This patch should help.

1 Like