title: UITextView correctly highlight words
body: <p>I'm trying to highlight a couple of words from textView with rounded rects. And it all seems good, except for the line breaks where I get unexpected behaviour. </p>
  
  <pre><code>override func draw(_ rect: CGRect) {
      super.draw(rect)
  
      for range in backgroundRangeArray {
          self.layoutManager.enumerateEnclosingRects(forGlyphRange: range, withinSelectedGlyphRange: range, in: textContainer) { (rect, _) in
              var newRect = rect
              newRect.origin.y += self.spacing
              newRect.size.height -= self.spacing + 3
  
              let bezierPath = UIBezierPath(roundedRect: newRect, cornerRadius: 2)
              self.highlightedTextColor.setFill()
              bezierPath.fill()
              bezierPath.close()
          }
      }
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/lKTMe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lKTMe.png" alt="enter image description here"></a>
  (note the unwanted space between <em>special characters</em>)</p>