title: NSLayoutManager returns incorrect glyphIndex for mousePosition in NSTextView
body: <p>I have an <code>NSTextView</code> subclass as the right item in an <code>NSSplitViewController</code>, the left panel is an <code>NSOutlineView</code>. To process mouse clicks while the command key is pressed in the text view, I added the following to find the glyph that is under the mouse: </p>
  
  <pre><code>override func mouseDown(with event: NSEvent) {
      guard
          let lm = self.layoutManager,
          let tc = self.textContainer
      else { return }
  
      let localMousePosition = convert(event.locationInWindow, to: nil)
      var partial = CGFloat(1.0)
      let glyphIndex = lm.glyphIndex(for: localMousePosition, in: tc, fractionOfDistanceThroughGlyph: &amp;partial)
  
      print(glyphIndex)
  }
  </code></pre>
  
  <p>However, this results in an index that is about 10 or so too high, thus selecting the wrong glyph. My text view has only monospaced characters, so the offset is not caused by additional glyphs.</p>
  
  <p>Interestingly, if I collapse the left panel (in code or in the storyboard), I get the correct index. But the offset in the x direction is more than the width of the left panel.</p>
  
  <p>What am I missing here, is there an error in the code above?</p>