Skip to content

Commit 2fed4e3

Browse files
author
Chris K
committed
Use indexOf instead of RegExp to check for line-endings.
1 parent 7e4997d commit 2fed4e3

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/ecma-debugger/stop_at.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,15 @@ cls.EcmascriptDebugger["6.0"].StopAt = function()
4747
var reformat_condition =
4848
[
4949
"var MAX_LINE_LENGTH = 160;",
50-
"var re = /(?:\\n|$)/g;",
5150
"var last = 0;",
52-
"var m = null;",
53-
"while (m = re.exec(scriptData))",
51+
"var index = 0;",
52+
"while ((index = scriptData.indexOf(\"\n\"), last) > -1)",
5453
"{",
55-
" if (m.index - last > MAX_LINE_LENGTH)",
54+
" if (index - last > MAX_LINE_LENGTH)",
5655
" return true;",
57-
" last = m.index;",
56+
" last = index + 1;",
5857
"}",
59-
"return false;"
58+
"return scriptData.length - last > MAX_LINE_LENGTH;"
6059
].join("");
6160

6261
var self = this;

0 commit comments

Comments
 (0)