code: function updateLines(from, to, newText, selFrom, selTo) {
        if (suppressEdits) return;
        var old = [];
        doc.iter(from.line, to.line + 1, function(line) {
          old.push(newHL(line.text, line.markedSpans));
        });
        if (history) {
          history.addChange(from.line, newText.length, old);
          while (history.done.length > options.undoDepth) history.done.shift();
        }
        var lines = updateMarkedSpans(hlSpans(old[0]), hlSpans(lst(old)), from.ch, to.ch, newText);
        updateLinesNoUndo(from, to, lines, selFrom, selTo);
      }
docs: Replace the range from from to to by the strings in newText. Afterwards, set the selection to selFrom, selTo.