title: NSAttributedString highlight/background color shows between lines (ugly)
body: <p>I'm trying to nicely display paragraphs of highlighted in a NSTextView. Right now, I'm doing this by creating a NSAttributedString with a background color. Here's some simplified code:</p>
  
  <pre><code>NSDictionary *attributes = @{NSBackgroundColorAttributeName:NSColor.greenColor};
  NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:@"Here is a single line of text with single spacing" attributes:attributes];
  
  [textView.textStorage setAttributedString:attrString];
  </code></pre>
  
  <p>This approach basically works, in that it produces highlighted text.</p>
  
  <p><img src="https://i.stack.imgur.com/C6LeX.png" alt="Single line single spaced"></p>
  
  <p>Unfortunately, when multiple lines exist, the highlight covers the vertical space <em>between</em> the lines in addition to the lines themselves, resulting in ugliness.</p>
  
  <p><img src="https://i.stack.imgur.com/AA7y2.png" alt="Multi line double spaced text"></p>
  
  <p>Does anyone know of a way to do this kind of highlighting in Cocoa? The picture below is basically what I'm looking for (ignore the shadow on the white boxes):</p>
  
  <p><img src="https://i.stack.imgur.com/EUuO7.png" alt="whiteout text"></p>
  
  <p>I'd be willing to use CoreText, html, or whatever is necessary to make things look nicer.</p>