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

Function lineStartSmart

static/editor.md/lib/codemirror/lib/codemirror.js:8392–8402  ·  view source on GitHub ↗
(cm, pos)

Source from the content-addressed store, hash-verified

8390 return Pos(lineN == null ? lineNo(line) : lineN, ch);
8391 }
8392 function lineStartSmart(cm, pos) {
8393 var start = lineStart(cm, pos.line);
8394 var line = getLine(cm.doc, start.line);
8395 var order = getOrder(line);
8396 if (!order || order[0].level == 0) {
8397 var firstNonWS = Math.max(0, line.text.search(/\S/));
8398 var inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch;
8399 return Pos(start.line, inWS ? 0 : firstNonWS);
8400 }
8401 return start;
8402 }
8403
8404 function compareBidiLevel(order, a, b) {
8405 var linedir = order[0].level;

Callers 1

codemirror.jsFile · 0.70

Calls 3

lineStartFunction · 0.70
getLineFunction · 0.70
getOrderFunction · 0.70

Tested by

no test coverage detected