MCPcopy Create free account
hub / github.com/breck7/scroll / markedSpansAfter

Function markedSpansAfter

external/.scrollLibs.js:1213–1227  ·  view source on GitHub ↗
(old, endCh, isInsert)

Source from the content-addressed store, hash-verified

1211 return nw
1212 }
1213 function markedSpansAfter(old, endCh, isInsert) {
1214 var nw
1215 if (old) {
1216 for (var i = 0; i < old.length; ++i) {
1217 var span = old[i],
1218 marker = span.marker
1219 var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh)
1220 if (endsAfter || (span.from == endCh && marker.type == "bookmark" && (!isInsert || span.marker.insertLeft))) {
1221 var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh)
1222 ;(nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh, span.to == null ? null : span.to - endCh))
1223 }
1224 }
1225 }
1226 return nw
1227 }
1228
1229 // Given a change object, compute the new set of marker spans that
1230 // cover the line in which the change took place. Removes spans

Callers 1

stretchSpansOverChangeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected