src/model/selection_updates.js
function skipAtomicInSelection(doc, sel, bias, mayClear) {
  let out
  for (let i = 0; i < sel.ranges.length; i++) {
    let range = sel.ranges[i]
    let old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i]
    let newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear)
    let newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear)
    if (out || newAnchor != range.anchor || newHead != range.head) {
      if (!out) out = sel.ranges.slice(0, i)
      out[i] = new Range(newAnchor, newHead)
    }
  }
  return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel
}
function skipAtomicInSelection(doc, sel, bias, mayClear) {
  let out
  for (let i = 0; i < sel.ranges.length; i++) {
    let range = sel.ranges[i]
    let old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i]
    let newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear)
    let newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear)
    if (out || newAnchor != range.anchor || newHead != range.head) {
      if (!out) out = sel.ranges.slice(0, i)
      out[i] = new Range(newAnchor, newHead)
    }
  }
  return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel
}
function skipAtomicInSelection ( doc , sel , bias , mayClear ) { let out for ( let i = 0 ; i < sel . ranges . length ; i ++ ) { let range = sel . ranges [ i ] let old = sel . ranges . length == doc . sel . ranges . length && doc . sel . ranges [ i ] let newAnchor = skipAtomic ( doc , range . anchor , old && old . anchor , bias , mayClear ) let newHead = skipAtomic ( doc , range . head , old && old . head , bias , mayClear ) if ( out || newAnchor != range . anchor || newHead != range . head ) { if ( ! out ) out = sel . ranges . slice ( 0 , i ) out [ i ] = new Range ( newAnchor , newHead ) } } return out ? normalizeSelection ( doc . cm , out , sel . primIndex ) : sel }
Return a selection that does not partially select any atomic ranges.
Return a selection that does not partially select any atomic ranges .