(cm)
| 1366 | } |
| 1367 | |
| 1368 | function highlightWorker(cm) { |
| 1369 | var doc = cm.doc; |
| 1370 | if (doc.frontier < doc.first) doc.frontier = doc.first; |
| 1371 | if (doc.frontier >= cm.display.viewTo) return; |
| 1372 | var end = +new Date + cm.options.workTime; |
| 1373 | var state = copyState(doc.mode, getStateBefore(cm, doc.frontier)); |
| 1374 | |
| 1375 | runInOp(cm, function() { |
| 1376 | doc.iter(doc.frontier, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function(line) { |
| 1377 | if (doc.frontier >= cm.display.viewFrom) { // Visible |
| 1378 | var oldStyles = line.styles; |
| 1379 | var highlighted = highlightLine(cm, line, state, true); |
| 1380 | line.styles = highlighted.styles; |
| 1381 | if (highlighted.classes) line.styleClasses = highlighted.classes; |
| 1382 | else if (line.styleClasses) line.styleClasses = null; |
| 1383 | var ischange = !oldStyles || oldStyles.length != line.styles.length; |
| 1384 | for (var i = 0; !ischange && i < oldStyles.length; ++i) ischange = oldStyles[i] != line.styles[i]; |
| 1385 | if (ischange) regLineChange(cm, doc.frontier, "text"); |
| 1386 | line.stateAfter = copyState(doc.mode, state); |
| 1387 | } else { |
| 1388 | processLine(cm, line.text, state); |
| 1389 | line.stateAfter = doc.frontier % 5 == 0 ? copyState(doc.mode, state) : null; |
| 1390 | } |
| 1391 | ++doc.frontier; |
| 1392 | if (+new Date > end) { |
| 1393 | startWorker(cm, cm.options.workDelay); |
| 1394 | return true; |
| 1395 | } |
| 1396 | }); |
| 1397 | }); |
| 1398 | } |
| 1399 | |
| 1400 | // Finds the line to start with when starting a parse. Tries to |
| 1401 | // find a line with a stateAfter, so that it can start with a |
nothing calls this directly
no test coverage detected