code: function extendSelection(doc, pos, other, bias) {
      if (doc.sel.shift || doc.sel.extend) {
        var anchor = doc.sel.anchor;
        if (other) {
          var posBefore = posLess(pos, anchor);
          if (posBefore != posLess(other, anchor)) {
            anchor = pos;
            pos = other;
          } else if (posBefore != posLess(pos, other)) {
            pos = other;
          }
        }
        setSelection(doc, anchor, pos, bias);
      } else {
        setSelection(doc, pos, other || pos, bias);
      }
      if (doc.cm) doc.cm.curOp.userSelChange = true;
    }
docs: If shift is held, this will move the selection anchor. Otherwise, it'll set the whole selection.