Re: Acquiring the visible characters from a NSTextView
Re: Acquiring the visible characters from a NSTextView
- Subject: Re: Acquiring the visible characters from a NSTextView
- From: Douglas Davidson <email@hidden>
- Date: Wed, 22 Jun 2005 12:29:01 -0700
On Jun 22, 2005, at 12:09 PM, Ian Archer wrote: I want to get a copy of the characters that are visible (from scrolling) within a NSTextView. Going through NSTextStorage->[NSMutableAttributedString mutableString] returns everything.
Are you interested only in vertical clipping? You would ask the text view for its visibleRect, convert that into container coordinates (by subtracting the text view's textContainerOrigin), ask the layout manager for the glyph range for that bounding rect, and then ask the layout manager to convert that glyph range to a character range. The result would be the range of interest in the text storage.
If you need to clip horizontally as well, that's a little trickier, because the result won't necessarily be a single range. You would need to go through and repeat the process line by line.
Douglas Davidson
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden