Skip to content

Commit

Permalink
fix: search box updateCounter
Browse files Browse the repository at this point in the history
  • Loading branch information
sekedus committed Nov 22, 2024
1 parent d530af2 commit 861e5d8
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/ext/searchbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,12 @@ class SearchBox {
? editor.session.getTextRange(this.searchRange)
: editor.getValue();

/**
* Convert all line ending variations to Unix-style = \n
* Windows (\r\n), MacOS Classic (\r), and Unix (\n)
*/
if (editor.$search.$isMultilineSearch(editor.getLastSearchOptions()))
value = value.replace(/\r\n|\r|\n/g, "\n");
// Replace newline sequences (\r\n, \r, \n) in the regex pattern with the editor's newline character.
var rePattern = /\\r\\n|\\r|\\n/g;
if (editor.$search.$isMultilineSearch(editor.getLastSearchOptions()) && regex.source.search(rePattern) != -1) {
var regexPattern = regex.source.replace(rePattern, lang.escapeRegExp(editor.session.doc.getNewLineCharacter()));
regex = new RegExp(regexPattern, regex.flags);
}

var offset = editor.session.doc.positionToIndex(editor.selection.anchor);
if (this.searchRange)
Expand Down

0 comments on commit 861e5d8

Please sign in to comment.