MCPcopy
hub / github.com/witheve/Eve / lineStartSmart

Function lineStartSmart

src/codemirror.js:8667–8677  ·  view source on GitHub ↗
(cm, pos)

Source from the content-addressed store, hash-verified

8665 return Pos(lineN == null ? lineNo(line) : lineN, ch);
8666 }
8667 function lineStartSmart(cm, pos) {
8668 var start = lineStart(cm, pos.line);
8669 var line = getLine(cm.doc, start.line);
8670 var order = getOrder(line);
8671 if (!order || order[0].level == 0) {
8672 var firstNonWS = Math.max(0, line.text.search(/\S/));
8673 var inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch;
8674 return Pos(start.line, inWS ? 0 : firstNonWS);
8675 }
8676 return start;
8677 }
8678
8679 function compareBidiLevel(order, a, b) {
8680 var linedir = order[0].level;

Callers 1

codemirror.jsFile · 0.85

Calls 3

lineStartFunction · 0.85
getLineFunction · 0.85
getOrderFunction · 0.85

Tested by

no test coverage detected