MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / lineStartSmart

Function lineStartSmart

lib/web/CodeMirror/src/edit/commands.js:168–178  ·  view source on GitHub ↗
(cm, pos)

Source from the content-addressed store, hash-verified

166 return endOfLine(true, cm, line, lineN, -1)
167}
168function lineStartSmart(cm, pos) {
169 let start = lineStart(cm, pos.line)
170 let line = getLine(cm.doc, start.line)
171 let order = getOrder(line, cm.doc.direction)
172 if (!order || order[0].level == 0) {
173 let firstNonWS = Math.max(start.ch, line.text.search(/\S/))
174 let inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch
175 return Pos(start.line, inWS ? 0 : firstNonWS, start.sticky)
176 }
177 return start
178}

Callers 1

commands.jsFile · 0.70

Calls 6

getLineFunction · 0.90
getOrderFunction · 0.90
PosFunction · 0.90
lineStartFunction · 0.70
maxMethod · 0.45
searchMethod · 0.45

Tested by

no test coverage detected