(cm, change, spans)
| 7334 | // Handle the interaction of a change to a document with the editor |
| 7335 | // that this document is part of. |
| 7336 | function makeChangeSingleDocInEditor(cm, change, spans) { |
| 7337 | var doc = cm.doc, |
| 7338 | display = cm.display, |
| 7339 | from = change.from, |
| 7340 | to = change.to |
| 7341 | |
| 7342 | var recomputeMaxLength = false, |
| 7343 | checkWidthStart = from.line |
| 7344 | if (!cm.options.lineWrapping) { |
| 7345 | checkWidthStart = lineNo(visualLine(getLine(doc, from.line))) |
| 7346 | doc.iter(checkWidthStart, to.line + 1, function (line) { |
| 7347 | if (line == display.maxLine) { |
| 7348 | recomputeMaxLength = true |
| 7349 | return true |
| 7350 | } |
| 7351 | }) |
| 7352 | } |
| 7353 | |
| 7354 | if (doc.sel.contains(change.from, change.to) > -1) { |
| 7355 | signalCursorActivity(cm) |
| 7356 | } |
| 7357 | |
| 7358 | updateDoc(doc, change, spans, estimateHeight(cm)) |
| 7359 | |
| 7360 | if (!cm.options.lineWrapping) { |
| 7361 | doc.iter(checkWidthStart, from.line + change.text.length, function (line) { |
| 7362 | var len = lineLength(line) |
| 7363 | if (len > display.maxLineLength) { |
| 7364 | display.maxLine = line |
| 7365 | display.maxLineLength = len |
| 7366 | display.maxLineChanged = true |
| 7367 | recomputeMaxLength = false |
| 7368 | } |
| 7369 | }) |
| 7370 | if (recomputeMaxLength) { |
| 7371 | cm.curOp.updateMaxLine = true |
| 7372 | } |
| 7373 | } |
| 7374 | |
| 7375 | retreatFrontier(doc, from.line) |
| 7376 | startWorker(cm, 400) |
| 7377 | |
| 7378 | var lendiff = change.text.length - (to.line - from.line) - 1 |
| 7379 | // Remember that these lines changed, for updating the display |
| 7380 | if (change.full) { |
| 7381 | regChange(cm) |
| 7382 | } else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change)) { |
| 7383 | regLineChange(cm, from.line, "text") |
| 7384 | } else { |
| 7385 | regChange(cm, from.line, to.line + 1, lendiff) |
| 7386 | } |
| 7387 | |
| 7388 | var changesHandler = hasHandler(cm, "changes"), |
| 7389 | changeHandler = hasHandler(cm, "change") |
| 7390 | if (changeHandler || changesHandler) { |
| 7391 | var obj = { |
| 7392 | from: from, |
| 7393 | to: to, |
no test coverage detected