On Jan 10, 2012, at 12:49 PM, James Merkel wrote:

> In my application I tab text (Helvetica 12 font) so that things line up in my 
> application window. 
> If I copy a text selection out of my app window and then look at the 
> clipboard, the text looks the same as in my window.
> If the clipboard is then pasted into a new TextEdit window or a new 
> TextWrangler window, the tabs don't hold.
> If the clipboard is pasted into the Xcode editor, the tabs do hold.
> How can I make sure that tabs are respected in other applications. (Or what 
> can I do in other applications to make sure that the tabs are respected) ?

I don’t think you can get this to work everywhere. The best you can do is to 
make sure that the NSAttributedString you write to the pasteboard has tab stops 
explicitly defined in its NSParagraphStyle. That should take care of apps that 
handle styled text, e.g. TextEdit. But TextWrangler and Xcode and other 
plain-text editors define tabs as a specific number of character widths, and 
that number is fixed as part of the document, so pasting text wouldn’t affect 
it.

Also, it just occurred to me, are you using multiple consecutive tab characters 
to try to force things to line up, or are you setting tab stops in the 
paragraph style? Using multiple tabs is a sure recipe for disaster*, one of 
those things they warn you not to do in Word Processing 101.

—Jens

* Sorry if that sounds harsh; I’m a typography geek. Don’t get me started about 
double-spacing after periods…

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to