MCPcopy
hub / github.com/nwutils/nw-sample-apps / markText

Function markText

mini-code-edit/cm/lib/codemirror.js:1432–1448  ·  view source on GitHub ↗
(from, to, className)

Source from the content-addressed store, hash-verified

1430 };
1431
1432 function markText(from, to, className) {
1433 from = clipPos(from); to = clipPos(to);
1434 var tm = new TextMarker();
1435 if (!posLess(from, to)) return tm;
1436 function add(line, from, to, className) {
1437 getLine(line).addMark(new MarkedText(from, to, className, tm));
1438 }
1439 if (from.line == to.line) add(from.line, from.ch, to.ch, className);
1440 else {
1441 add(from.line, from.ch, null, className);
1442 for (var i = from.line + 1, e = to.line; i < e; ++i)
1443 add(i, null, null, className);
1444 add(to.line, null, to.ch, className);
1445 }
1446 changes.push({from: from.line, to: to.line + 1});
1447 return tm;
1448 }
1449
1450 function setBookmark(pos) {
1451 pos = clipPos(pos);

Callers 1

matchBracketsFunction · 0.85

Calls 3

clipPosFunction · 0.85
posLessFunction · 0.85
addFunction · 0.70

Tested by

no test coverage detected