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

Function lineStartSmart

external/.scrollLibs.js:9731–9741  ·  view source on GitHub ↗
(cm, pos)

Source from the content-addressed store, hash-verified

9729 return endOfLine(true, cm, line, lineN, -1)
9730 }
9731 function lineStartSmart(cm, pos) {
9732 var start = lineStart(cm, pos.line)
9733 var line = getLine(cm.doc, start.line)
9734 var order = getOrder(line, cm.doc.direction)
9735 if (!order || order[0].level == 0) {
9736 var firstNonWS = Math.max(0, line.text.search(/\S/))
9737 var inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch
9738 return Pos(start.line, inWS ? 0 : firstNonWS, start.sticky)
9739 }
9740 return start
9741 }
9742
9743 // Run a handler that was bound to a key.
9744 function doHandleBinding(cm, bound, dropShift) {

Callers 1

.scrollLibs.jsFile · 0.85

Calls 5

getLineFunction · 0.85
PosFunction · 0.85
maxMethod · 0.80
lineStartFunction · 0.70
getOrderFunction · 0.70

Tested by

no test coverage detected