Skip to content
Snippets Groups Projects
Commit a13244a2 authored by George Nachman's avatar George Nachman
Browse files

Improvements for services. Only validate services that don't expect us to send...

Improvements for services. Only validate services that don't expect us to send data, unless we have a selection. If we do have a selection, it must take plain text as input. likewise, the service must produce no or plain text output. If it does produce output, call insertText: with it.

Issue 5942
parent 7e60ad38
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -5583,11 +5583,14 @@ static double EuclideanDistance(NSPoint p1, NSPoint p2) {
// service stuff
- (id)validRequestorForSendType:(NSString *)sendType returnType:(NSString *)returnType
{
if (sendType == nil || [sendType isEqualToString:NSStringPboardType]) {
NSSet *acceptedReturnTypes = [NSSet setWithArray:@[ (NSString *)kUTTypeUTF8PlainText,
NSStringPboardType ]];
if (sendType == nil &&
(returnType == nil || [acceptedReturnTypes containsObject:returnType])) {
return self;
} else {
return nil;
}
return ([super validRequestorForSendType:sendType returnType:returnType]);
}
 
// Service
Loading
Loading
@@ -5611,7 +5614,13 @@ static double EuclideanDistance(NSPoint p1, NSPoint p2) {
 
// Service
- (BOOL)readSelectionFromPasteboard:(NSPasteboard *)pboard {
return YES;
NSString *string = [pboard stringForType:NSStringPboardType];
if (string.length) {
[_delegate insertText:string];
return YES;
} else {
return NO;
}
}
 
// This textview is about to be hidden behind another tab.
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment