Re: NSTextView paste:

2012-08-15 Thread ecir hana
On Tue, Aug 14, 2012 at 2:43 AM, Seth Willits wrote: > > - (BOOL)readSelectionFromPasteboard:(NSPasteboard *)pboard type:(NSString > *)type > { > if ([type isEqual:NSStringPboardType]) { > if ([[pboard stringForType:type] isEqual:@"foo"]) { > NSRang

Re: NSTextView paste:

2012-08-13 Thread Seth Willits
On Aug 13, 2012, at 3:55 PM, ecir hana wrote: > Thank you for the reply! Unfortunately, there seem to be a tiny bug with > undo. My textview has "setRichText:" set to NO so that it triggers the first > condition. When the textview looks like this: > > aaa > bbb > > and I select and copy "aaa",

Re: NSTextView paste:

2012-08-13 Thread Graham Cox
On 14/08/2012, at 3:54 AM, ecir hana wrote: > Please, does anyone know how to approach this? You don't need to do anything, AFAICS. NSTextView supports -paste: and will do the right thing internally. You only have to ensure it's first responder at the time you want to paste. --Graham __

Re: NSTextView paste:

2012-08-13 Thread ecir hana
On Tue, Aug 14, 2012 at 12:55 AM, ecir hana wrote: > > > > aaa > bbb > > > I mean: foo foo ___ 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

Re: NSTextView paste:

2012-08-13 Thread ecir hana
On Mon, Aug 13, 2012 at 11:45 PM, Seth Willits wrote: > > > - (BOOL)readSelectionFromPasteboard:(NSPasteboard *)pboard type:(NSString > *)type > { > if ([type isEqual:NSStringPboardType]) { > if ([[pboard stringForType:type] isEqual:@"foo"]) { > [se

Re: NSTextView paste:

2012-08-13 Thread Seth Willits
On Aug 13, 2012, at 10:54 AM, ecir hana wrote: > I have a NSTextView, where the user can paste plain text into. > > When the users has "foo" in the pasteboard I would like "bar" to be pasted. > In other words, a user goes to, say, a web browser, selects "foo", cmd+c, > switches to my NSTextView,

NSTextView paste:

2012-08-13 Thread ecir hana
Dear list, I have a NSTextView, where the user can paste plain text into. When the users has "foo" in the pasteboard I would like "bar" to be pasted. In other words, a user goes to, say, a web browser, selects "foo", cmd+c, switches to my NSTextView, cmd+v and "bar" appears at insertion point. P