code: function isInViewStateSelection(range, viewState) {
              if (!viewState || !viewState.selections) {
                  return false;
              }
  
              return viewState.selections.some(function (selection) {
                  return rangeEqualsSelection(range, selection);
              });
          }
docs: Checks if the range is equal to one of the selections in the viewState
  @param   {Object}  range     {from, to} where from and to are CodeMirror.Pos objects.
  @param   {Object}  viewState The current editor's ViewState object
  @returns {Boolean} true if the range is found in the list of selections or false if not.