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

Function rangeForUnit

external/.scrollLibs.js:10162–10174  ·  view source on GitHub ↗
(cm, pos, unit)

Source from the content-addressed store, hash-verified

10160 }
10161
10162 function rangeForUnit(cm, pos, unit) {
10163 if (unit == "char") {
10164 return new Range(pos, pos)
10165 }
10166 if (unit == "word") {
10167 return cm.findAtomAt(pos)
10168 }
10169 if (unit == "line") {
10170 return new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0)))
10171 }
10172 var result = unit(cm, pos)
10173 return new Range(result.from, result.to)
10174 }
10175
10176 // Normal selection, as opposed to text dragging.
10177 function leftButtonSelect(cm, event, start, behavior) {

Callers 2

leftButtonSelectFunction · 0.85
extendToFunction · 0.85

Calls 2

PosFunction · 0.85
clipPosFunction · 0.85

Tested by

no test coverage detected