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

  func rangeForTokenInsertionForStringWithNewLine()-> NSRange {
    let numberOfGlyphs = layoutManager.numberOfGlyphs
    var index = 0
    let lineRange = NSMakeRange(NSNotFound, 0);
    let approximateNumberOfLines = Int(layoutManager.usedRectForTextContainer(textContainer).height) / Int(font.lineHeight)

    for (numberOfLines = 0, index = 0; index < numberOfGlyphs; numberOfLines++) {
      var lineRange = NSMakeRange(NSNotFound,0)
      layoutManager.lineFragmentRectForGlyphAtIndex(index, effectiveRange: &lineRange)
      if (numberOfLines == approximateNumberOfLines - 1){ break}
      index = NSMaxRange(lineRange);
    }
    

  }
  
  func rangeForTokenInsertion()-> NSRange {
    textContainer.size = self.bounds.size
    println("size = \(textContainer.size.width) x \(textContainer.size.height)")
    println("label size = \(self.frame.size.width) x \(self.frame.size.height)")
    println("length \(textStorage.length)")
    let glyphIndex = layoutManager.glyphIndexForCharacterAtIndex(textStorage.length-1)
    println("glyph index = \(glyphIndex)")

    var range = layoutManager.truncatedGlyphRangeInLineFragmentForGlyphAtIndex(glyphIndex)
    println("range = \(range.location) x \(range.length)")
    if (range.length > 0 && customTruncationEnabled) {
      range.length += attributedTruncationToken!.length
      range.location -= attributedTruncationToken!.length
    }
