Code Duplication    Length = 12-13 lines in 2 locations

styles/all/theme/vendor/codemirror/lib/codemirror.js 2 locations

@@ 542-554 (lines=13) @@
539
  } }
540
  return nw
541
}
542
function markedSpansAfter(old, endCh, isInsert) {
543
  var nw
544
  if (old) { for (var i = 0; i < old.length; ++i) {
545
    var span = old[i], marker = span.marker
546
    var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh)
547
    if (endsAfter || span.from == endCh && marker.type == "bookmark" && (!isInsert || span.marker.insertLeft)) {
548
      var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh)
549
      ;(nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh,
550
                                            span.to == null ? null : span.to - endCh))
551
    }
552
  } }
553
  return nw
554
}
555
556
// Given a change object, compute the new set of marker spans that
557
// cover the line in which the change took place. Removes spans
@@ 530-541 (lines=12) @@
527
// document. These functions cut an array of spans at a given
528
// character position, returning an array of remaining chunks (or
529
// undefined if nothing remains).
530
function markedSpansBefore(old, startCh, isInsert) {
531
  var nw
532
  if (old) { for (var i = 0; i < old.length; ++i) {
533
    var span = old[i], marker = span.marker
534
    var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh)
535
    if (startsBefore || span.from == startCh && marker.type == "bookmark" && (!isInsert || !span.marker.insertLeft)) {
536
      var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh)
537
      ;(nw || (nw = [])).push(new MarkedSpan(marker, span.from, endsAfter ? null : span.to))
538
    }
539
  } }
540
  return nw
541
}
542
function markedSpansAfter(old, endCh, isInsert) {
543
  var nw
544
  if (old) { for (var i = 0; i < old.length; ++i) {