         cursorPosition += string.characters.count
 
         let newFormattedText = self.formattedText(fromText: unformattedText, textMask: textMask, cursorPosition: &cursorPosition)
-        self.formattedText = newFormattedText
+        text = newFormattedText
         placeholderLabel.isHidden = (unformattedText.characters.count > 0)
 
         cursorPosition = min(cursorPosition, newFormattedText.characters.count)
         let cursorIndex = newFormattedText.index(newFormattedText.startIndex, offsetBy: cursorPosition)
-        let utf16CursorPosition = newFormattedText.utf16Nsrange(fromRange: cursorIndex..<cursorIndex).location
-
-        let targetPosition = position(from: beginningOfDocument, offset: utf16CursorPosition)!
-        selectedTextRange = self.textRange(from: targetPosition, to: targetPosition)
+        selectedCharachtersRange = cursorIndex..<cursorIndex
 
         sendActions(for: .editingChanged)
 

            let unformattedText = value ?? ""
            let formattedText = self.formattedText(fromText: unformattedText, textMask: textMask, cursorPosition: &cursorPosition)
            if formattedText.characters.count > 0 || value != nil {
                self.formattedText = formattedText
            } else {
                self.formattedText = nil
            }
            placeholderLabel.isHidden = (unformattedText.characters.count > 0)
        }

        var unformattedText = unformatterText(fromText: formattedText, textMask: textMask, cursorPosition: &cursorPosition)
        let unformattedRange = self.range(fromFormattedRange: charachtersRange)

        if let originDelegate = (delegateProxy.delegate as? FormattedTextFieldDelegate),
            originDelegate.responds(to: #selector(FormattedTextFieldDelegate.textField(_:shouldChangeUnformattedText:in:replacementString:))) {

            let utf16UnformattedRange = unformattedText.utf16Nsrange(fromRange: unformattedText.range(fromNsRange: unformattedRange)!)
            if !originDelegate.textField!(self, shouldChangeUnformattedText:unformattedText, in:utf16UnformattedRange, replacementString: string) {
                return false
            }
        }
