When CodeMirror highlights selection matches it ignores surrounding whitespace in the selection.
Given the text
// foobarbaz
// foobar
// barbaz
bar
if you select the entire last line, any occurrence of “bar” in the previous lines will be highlighted despite having a different prefix and suffix:
vscode for comparison considers the whitespace:
Is the CodeMirror behavior by design? If yes, is there an option to only highlight exact matches?
marijn
January 15, 2024, 7:33am
2
Where that came from is lost to git history (it was already there in the patch that moves this code into @codemirror /search), but I don’t see a particularly good reason for it to work this way, so this patch removes it.
committed 07:32AM - 15 Jan 24 UTC
FIX: Make `highlightSelectionMatches` include whitespace in the selection in its…
matches.
See https://discuss.codemirror.net/t/selectionmatch-ignores-surrounding-whitespace/7697
1 Like