Re: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo
Re: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo
- Subject: Re: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo
- From: Bill Cheeseman <email@hidden>
- Date: Tue, 26 Apr 2016 05:00:34 -0400
Graham Cox is right.
I realized overnight that I was misinterpreting your question. I happen to be working on truncation of text myself, and I was focused on the usual meaning of "truncation" in the attributed string context. It means placing three periods at the end or in the middle of truncated lines of text.
What you are trying to do, as I now understand it, is to keep the original line breaks of the text in place, without "wrapping," even though the text view or window is made narrower. In other words, your text view will act like a peephole into a bigger page. That is what NSTextContainer is for. I think the references I gave to you for text handling in general will lead you to the relevant documentation.
From the NSTextContainer reference document:
"The NSTextContainer class defines a region where text is laid out. An NSLayoutManager <https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSLayoutManager_Class/index.html#//apple_ref/occ/cl/NSLayoutManager> uses NSTextContainer to determine where to break lines, lay out portions of text, and so on. An NSTextContainerobject normally defines rectangular regions, but you can define exclusion paths inside the text container to create regions where text does not flow. You can also subclass to create text containers with nonrectangular regions, such as circular regions, regions with holes in them, or regions that flow alongside graphics."
Since you're in a very speed-sensitive environment, you will also be interested in the paragraph that follows that quoted text, about using threads.
> On Apr 25, 2016, at 11:34 AM, Dave <email@hidden <mailto:email@hidden>> wrote:
>
> I’m familiar with NSAttributedString and friends. I had thought that there was a higher level interface to it as it seems like a common thing to want to do.
>
> Basically my ScrollView is just a scrolling line log similar to XCode’s NSLog window.
--
Bill Cheeseman - email@hidden <mailto:email@hidden>
--
Bill Cheeseman - email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden