'Checks if the textCursor is in the decoration.
:param cursor: The text cursor to test
:type cursor: QtGui.QTextCursor
:returns: True if the cursor is over the selection'

def contains_cursor(self, cursor):

    start = self.cursor.selectionStart()
    end = self.cursor.selectionEnd()
    if cursor.atBlockEnd():
        end -= 1
    return (start <= cursor.position() <= end)
