'Select cell under cursor
cell = group of lines separated by CELL_SEPARATORS
returns the textCursor and a boolean indicating if the
entire file is selected'

def select_current_cell(self):

    cursor = self.textCursor()
    cursor.movePosition(QTextCursor.StartOfBlock)
    cur_pos = prev_pos = cursor.position()
    while self.is_cell_separator(cursor):
        cursor.movePosition(QTextCursor.NextBlock)
        prev_pos = cur_pos
        cur_pos = cursor.position()
        if (cur_pos == prev_pos):
            return (cursor, False)
    prev_pos = cur_pos
    while (not self.is_cell_separator(cursor)):
        cursor.movePosition(QTextCursor.PreviousBlock)
        prev_pos = cur_pos
        cur_pos = cursor.position()
        if (cur_pos == prev_pos):
            if self.is_cell_separator(cursor):
                return (cursor, False)
            else:
                break
    cursor.setPosition(prev_pos)
    cell_at_file_start = cursor.atStart()
    while (not self.is_cell_separator(cursor)):
        cursor.movePosition(QTextCursor.NextBlock, QTextCursor.KeepAnchor)
        cur_pos = cursor.position()
        if (cur_pos == prev_pos):
            cursor.movePosition(QTextCursor.EndOfBlock, QTextCursor.KeepAnchor)
            break
        prev_pos = cur_pos
    cell_at_file_end = cursor.atEnd()
    return (cursor, (cell_at_file_start and cell_at_file_end))
