     if not selection.isValid()
       throw new Error "Invalid selection"
 
+    # In case the selection already has a style (which is different)
+    if selection.style != style
+      selection = new Selection(selection.start, selection.end, style)
+
+    if _.isUndefined selection.style
+      selection.style = style
+
+    @getWord(selection.startPos.word).word
+
     # Try to merge with previous / next contiguous selection
     {prevWord, position} = @_jump(selection.startPos, -1)
     {nextWord, position} = @_jump(selection.endPos,   +1)

    # insert the content at position
    currWord = currWord.substring(0, pos) + content + currWord.substring(pos)

    # cut the word
    newWords = currWord.match WordRegExp
    tmp = currWord.match PreSpacesRegExp
    if tmp isnt null

      rte.getWord(@startPos.word).removeSel(@)
    else if @endPos.word == selection.startPos.word or
       (@endPos.word == selection.startPos.word -1 and
        @endPos.loc == rte.getWord(@endPos.word).word.length() and
        selection.startPos.loc == 0)
      start = @startPos
      end = selection.endPos
      rte.getWord(@endPos.word).word.removeSel(@)
      rte.getWord(selection.endPos.word).word.removeSel(selection)
    else
      return

    nSelec = new Selection start, end, selection.style
    rte.getWord().word


# Class describing the Rich Text Editor type
