(cm, change, spans)
| 5426 | // Handle the interaction of a change to a document with the editor |
| 5427 | // that this document is part of. |
| 5428 | function makeChangeSingleDocInEditor(cm, change, spans) { |
| 5429 | var doc = cm.doc, display = cm.display, from = change.from, to = change.to; |
| 5430 | |
| 5431 | var recomputeMaxLength = false, checkWidthStart = from.line; |
| 5432 | if (!cm.options.lineWrapping) { |
| 5433 | checkWidthStart = lineNo(visualLine(getLine(doc, from.line))); |
| 5434 | doc.iter(checkWidthStart, to.line + 1, function (line) { |
| 5435 | if (line == display.maxLine) { |
| 5436 | recomputeMaxLength = true; |
| 5437 | return true |
| 5438 | } |
| 5439 | }); |
| 5440 | } |
| 5441 | |
| 5442 | if (doc.sel.contains(change.from, change.to) > -1) |
| 5443 | { signalCursorActivity(cm); } |
| 5444 | |
| 5445 | updateDoc(doc, change, spans, estimateHeight(cm)); |
| 5446 | |
| 5447 | if (!cm.options.lineWrapping) { |
| 5448 | doc.iter(checkWidthStart, from.line + change.text.length, function (line) { |
| 5449 | var len = lineLength(line); |
| 5450 | if (len > display.maxLineLength) { |
| 5451 | display.maxLine = line; |
| 5452 | display.maxLineLength = len; |
| 5453 | display.maxLineChanged = true; |
| 5454 | recomputeMaxLength = false; |
| 5455 | } |
| 5456 | }); |
| 5457 | if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; } |
| 5458 | } |
| 5459 | |
| 5460 | retreatFrontier(doc, from.line); |
| 5461 | startWorker(cm, 400); |
| 5462 | |
| 5463 | var lendiff = change.text.length - (to.line - from.line) - 1; |
| 5464 | // Remember that these lines changed, for updating the display |
| 5465 | if (change.full) |
| 5466 | { regChange(cm); } |
| 5467 | else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change)) |
| 5468 | { regLineChange(cm, from.line, "text"); } |
| 5469 | else |
| 5470 | { regChange(cm, from.line, to.line + 1, lendiff); } |
| 5471 | |
| 5472 | var changesHandler = hasHandler(cm, "changes"), changeHandler = hasHandler(cm, "change"); |
| 5473 | if (changeHandler || changesHandler) { |
| 5474 | var obj = { |
| 5475 | from: from, to: to, |
| 5476 | text: change.text, |
| 5477 | removed: change.removed, |
| 5478 | origin: change.origin |
| 5479 | }; |
| 5480 | if (changeHandler) { signalLater(cm, "change", cm, obj); } |
| 5481 | if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); } |
| 5482 | } |
| 5483 | cm.display.selForContextMenu = null; |
| 5484 | } |
| 5485 |
no test coverage detected