code: def selection_range(self):  # XXX: shouldn't this return `None` if there is no selection???
          
          if self.selection:
              from_, to = sorted([self.cursor_position, self.selection.original_cursor_position])
          else:
              from_, to = self.cursor_position, self.cursor_position
  
          return from_, to
docs: Return (from, to) tuple of the selection.
          start and end position are included.
  
          This doesn't take the selection type into account. Use
          `selection_ranges` instead.