           if let attributes = descriptor.patternAttributes {
             textStorage.addAttributes(descriptor.patternAttributes!, range: truncationRange)
           }
-        }        
+        }
       }
+    
     }
 
   }

  }
  
  func rangeForTokenInsertion()-> NSRange {
    //    textContainer.size = self.bounds.size
    let glyphIndex = layoutManager.glyphIndexForCharacterAtIndex(textStorage.length-1)
    var range = layoutManager.truncatedGlyphRangeInLineFragmentForGlyphAtIndex(glyphIndex)
    if (range.location != NSNotFound && customTruncationEnabled) {
      range.length += attributedTruncationToken!.length
      range.location -= attributedTruncationToken!.length
    }

    if (shouldAppendTruncationToken() && !truncationTokenAppended()) {
      if isNewLinePresent() {
        //Append token string at the end of last visible line
        let range = rangeForTokenInsertionForStringWithNewLine()
        if range.length > 0 {
          textStorage.replaceCharactersInRange(range, withAttributedString: attributedTruncationToken!)
        }
      }
      //Check for truncation range and append truncation token if required
      let tokenRange = rangeForTokenInsertion()
      
      if (tokenRange.length > 0 && tokenRange.location >= 0) {
        self.textStorage.replaceCharactersInRange(tokenRange, withAttributedString:attributedTruncationToken!)
        self.redrawTextForRange(NSMakeRange(0, textStorage.length))
      }
    
      //Apply attributes if truncation token appended
      let truncationRange = rangeOfTruncationToken()
      if (truncationRange.location != NSNotFound) {
        removeAttributeForTruncatedRange()
