MCPcopy Create free account
hub / github.com/TruthHun/BookStack / markedSpansAfter

Function markedSpansAfter

static/editor.md/lib/codemirror/lib/codemirror.js:6146–6157  ·  view source on GitHub ↗
(old, endCh, isInsert)

Source from the content-addressed store, hash-verified

6144 return nw;
6145 }
6146 function markedSpansAfter(old, endCh, isInsert) {
6147 if (old) for (var i = 0, nw; i < old.length; ++i) {
6148 var span = old[i], marker = span.marker;
6149 var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh);
6150 if (endsAfter || span.from == endCh && marker.type == "bookmark" && (!isInsert || span.marker.insertLeft)) {
6151 var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh);
6152 (nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh,
6153 span.to == null ? null : span.to - endCh));
6154 }
6155 }
6156 return nw;
6157 }
6158
6159 // Given a change object, compute the new set of marker spans that
6160 // cover the line in which the change took place. Removes spans

Callers 1

stretchSpansOverChangeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected