(doc, pos, oldPos, dir, mayClear)
| 2242 | } |
| 2243 | |
| 2244 | function skipAtomicInner(doc, pos, oldPos, dir, mayClear) { |
| 2245 | var line = getLine(doc, pos.line); |
| 2246 | if (line.markedSpans) for (var i = 0; i < line.markedSpans.length; ++i) { |
| 2247 | var sp = line.markedSpans[i], m = sp.marker; |
| 2248 | if ((sp.from == null || (m.inclusiveLeft ? sp.from <= pos.ch : sp.from < pos.ch)) && |
| 2249 | (sp.to == null || (m.inclusiveRight ? sp.to >= pos.ch : sp.to > pos.ch))) { |
| 2250 | if (mayClear) { |
| 2251 | signal(m, "beforeCursorEnter"); |
| 2252 | if (m.explicitlyCleared) { |
| 2253 | if (!line.markedSpans) break; |
| 2254 | else {--i; continue;} |
| 2255 | } |
| 2256 | } |
| 2257 | if (!m.atomic) continue; |
| 2258 | |
| 2259 | if (oldPos) { |
| 2260 | var near = m.find(dir < 0 ? 1 : -1), diff; |
| 2261 | if (dir < 0 ? m.inclusiveRight : m.inclusiveLeft) |
| 2262 | near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null); |
| 2263 | if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0)) |
| 2264 | return skipAtomicInner(doc, near, pos, dir, mayClear); |
| 2265 | } |
| 2266 | |
| 2267 | var far = m.find(dir < 0 ? -1 : 1); |
| 2268 | if (dir < 0 ? m.inclusiveLeft : m.inclusiveRight) |
| 2269 | far = movePos(doc, far, dir, far.line == pos.line ? line : null); |
| 2270 | return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null; |
| 2271 | } |
| 2272 | } |
| 2273 | return pos; |
| 2274 | } |
| 2275 | |
| 2276 | // Ensure a given position is not inside an atomic range. |
| 2277 | function skipAtomic(doc, pos, oldPos, bias, mayClear) { |
no test coverage detected