Re: NSTextView paste:
Re: NSTextView paste:
- Subject: Re: NSTextView paste:
- From: ecir hana <email@hidden>
- Date: Tue, 14 Aug 2012 00:55:12 +0200
On Mon, Aug 13, 2012 at 11:45 PM, Seth Willits <email@hidden> wrote:
>
>
> - (BOOL)readSelectionFromPasteboard:(NSPasteboard *)pboard type:(NSString
> *)type
> {
> if ([type isEqual:NSStringPboardType]) {
> if ([[pboard stringForType:type] isEqual:@"foo"]) {
> [self insertText:@"bar"];
> return YES;
> }
> }
>
> return [super readSelectionFromPasteboard:pboard type:type];
> }
>
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", then select "bbb", delete it by hitting "<--",
paste "aaa", and then I try to undo, it does nothing, i.e. the last line
remains "bbb", instead of "". In menubar, there it even says "Undo Paste"
but it does nothing.
Any idea would that could be?
_______________________________________________
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