marijnh/CodeMirror2 — Issue #401: MarkText hangs browser when end ch is less than beginning ch on the same line
Author: amphro
Created: 2012-02-27 17:11:31+00:00
State: open

When I use markText with an end ch less than the beginning ch on the same line, the browser will crash. Seems like an infinite loop or endless recursion. Granted, the end ch should never be less that the beginning ch if they are on the same line, but it would be nice if it didn't add the marker, instead of freezing the browser. Tested on Firefox 4.0 and Chrome.

To see this happen, go to http://jsbin.com/emutug/edit#javascript,html,live and modify

codeMirror.markText(
{line: 0, ch: 10},
{line: 0, ch: 28},

to

codeMirror.markText(
{line: 0, ch: 10},
{line: 0, ch: 2},
"highlight1"
);

Please note that I got the above link from a different question on the google groups. I just used it to show this bug, but can provide another example.