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

Function skipAtomic

lib/web/CodeMirror/src/model/selection_updates.js:189–200  ·  view source on GitHub ↗
(doc, pos, oldPos, bias, mayClear)

Source from the content-addressed store, hash-verified

187
188// Ensure a given position is not inside an atomic range.
189export function skipAtomic(doc, pos, oldPos, bias, mayClear) {
190 let dir = bias || 1
191 let found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) ||
192 (!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) ||
193 skipAtomicInner(doc, pos, oldPos, -dir, mayClear) ||
194 (!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true))
195 if (!found) {
196 doc.cantEdit = true
197 return Pos(doc.first, 0)
198 }
199 return found
200}
201
202function movePos(doc, pos, dir, line) {
203 if (dir < 0 && pos.ch == 0) {

Callers 3

makeChangeSingleDocFunction · 0.90
findPosHFunction · 0.90
skipAtomicInSelectionFunction · 0.70

Calls 2

PosFunction · 0.90
skipAtomicInnerFunction · 0.70

Tested by

no test coverage detected