Hi,
I am writing a Cocoa application where I would like to copy tabular data from my application and paste it into textmate. However, I would like the pasting to occur just as if I had copied a columnar selection within textmate. Is there a way I can format this string data so that textmate recognizes it is a columnar selection?
Thanks, Josh Shapiro
On 29 May 2010, at 23:16, Joshua Shapiro wrote:
[...] Is there a way I can format this string data so that textmate recognizes it is a columnar selection?
You need to store a property list as the OakTextMatePboardType with a ‘content’ key (actual string) and ‘rectangular’ set to the string value YES.
E.g.:
id plist = [NSDictionary dictionaryWithObjectsAndKeys: @"foo\nbar\n", @"content", @"YES", @"rectangular", nil ];
NSPasteboard* pboard = [NSPasteboard generalPasteboard]; [pboard declareTypes:[NSArray arrayWithObject:@"OakTextMatePboardType"] owner:nil]; [pboard setPropertyList:plist forType:@"OakTextMatePboardType"];
In practice you also want to provide an NSStringPboardType alternative.
Note that this is not a documented pasteboard type so no guarantees about future compatibility with this format etc.
On Sun, May 30, 2010 at 4:13 AM, Allan Odgaard mailinglist@textmate.orgwrote:
On 29 May 2010, at 23:16, Joshua Shapiro wrote:
[...] Is there a way I can format this string data so that textmate
recognizes it is a columnar selection?
You need to store a property list as the OakTextMatePboardType with a ‘content’ key (actual string) and ‘rectangular’ set to the string value YES.
Perfect. Thanks.
Note that this is not a documented pasteboard type so no guarantees about future compatibility with this format etc.
Noted.