Re: Respecting tabs across applications
Re: Respecting tabs across applications
- Subject: Re: Respecting tabs across applications
- From: Ross Carter <email@hidden>
- Date: Wed, 11 Jan 2012 11:39:23 -0500
On Jan 10, 2012, at 10:14 PM, James Merkel wrote:
> the default NSParagraphStyle is being applied to my string.
To be precise, a NSParagraphStyle is being applied to your attributed string. The NSString does not contain any formatting information.
When you copy rich text, say from TextEdit, you place two sets of data on the pasteboard: the rich text data with the NSParagraphStyle and font information, and plain text data, which is just the characters. When you paste into a document, the receiving app chooses the item on the pasteboard that it wants to use. A code editor might prefer the plain text version, whereas a word processor would prefer the rich text version.
If you want the text to line up neatly in an app that takes plain text from the pasteboard, you probably want to align everything using spaces, as Jens said. If you want the text to align in an app that uses rich text, you should use tabs and define their location using NSParagraphStyle. To handle both possibilities, you need to manage what gets put on the pasteboard. If you are using NSTextView, there are some pasteboard methods available for you to override.
Ross
_______________________________________________
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