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

Function markedSpansBefore

external/.scrollLibs.js:1198–1212  ·  view source on GitHub ↗
(old, startCh, isInsert)

Source from the content-addressed store, hash-verified

1196 // character position, returning an array of remaining chunks (or
1197 // undefined if nothing remains).
1198 function markedSpansBefore(old, startCh, isInsert) {
1199 var nw
1200 if (old) {
1201 for (var i = 0; i < old.length; ++i) {
1202 var span = old[i],
1203 marker = span.marker
1204 var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh)
1205 if (startsBefore || (span.from == startCh && marker.type == "bookmark" && (!isInsert || !span.marker.insertLeft))) {
1206 var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh)
1207 ;(nw || (nw = [])).push(new MarkedSpan(marker, span.from, endsAfter ? null : span.to))
1208 }
1209 }
1210 }
1211 return nw
1212 }
1213 function markedSpansAfter(old, endCh, isInsert) {
1214 var nw
1215 if (old) {

Callers 1

stretchSpansOverChangeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected