added a check to getCurrentSelectionRange to make sure nothing is selected