search addon in chrome

Hi,

While working with regular expression in search option with carriage return. the codemirror hangs in chrome.

I can’t reproduce this. Please be more specific about what you are doing that causes a hang. Just typing in /\r/ does not show any problem.

I didn’t get the problem with search addon for \r or \W, but if I search through seprate text it hangs. below is the code I have made.

function asynctext(fullWord, classelement, cntid) {
var test = 0;
var lineposition = [];
var Pos = CodeMirror.Pos;
var from = editor.getCursor('from'),
to = editor.getCursor('to');
editor.setCursor(0, 0);
fullWord.forEach(function (query) {
  for (var cursor = editor.getSearchCursor(query, to); cursor.findNext(); ) {
  editor.setSelection(cursor.from(), cursor.to(), false);
  lineposition.push({
    lnfrm: cursor.from() .line,
    offfrm: cursor.from() .ch,
    lnto: cursor.to() .line,
    offto: cursor.to() .ch,
    text: editor.getSelection()
  });
  //console.log(test);
  test = test + 1;
}
});
//elementlist(classelement, lineposition, cntid, test)
	console.log(lineposition + "," + test);
test = 0;
}

In the above code I searching the text inbetween ( <sometag>((?:[^<]+|<(?!\/sometag>))+)<\/sometag>).

it hangs if the tag look like below

<sometag>text text text

text text</sometag>

Please create a self-contained and minimal demo of your problem. (I.e. write an HTML file that reproduces it, and remove all unnecessary code, so that I don’t have to debug your code.)

Hi,

I have attached reproducable html file with code.

chrome-bug2.html (8.0 KB)

Thanks,
Karthikeyan

I don’t see any carriage returns anywhere in this problem, so I’m not sure what you mean.

Thanks for the reply!

all browser are being hang when searching with regex like this.

is that something can be done to find the carriage return with search addon. it seems not finding at all.

I don’t see any carriage returns anywhere in this problem, so I’m not sure what you mean.