Im doing some drawing in an NSTextView, and I'd like to get the rect of the currently selected line (when there is no selection, so just where the cursor is). I've done some research and it seems I have to use the NSLayoutManager of the text view. This is where I'm completely stuck, it seems like lineFragmentRectForGlyphAtIndex:effectiveRange: could be useful, but after experimenting, I just can't seem to get it right.
Any help is appreciated,
Oliver