quicksilver / Quicksilver

Quicksilver Project Source
http://qsapp.com
Apache License 2.0
2.75k stars 286 forks source link

QSFormulaType objects don't add strings to the pasteboard #2899

Closed pjrobertson closed 4 months ago

pjrobertson commented 2 years ago

Try doing:

=1+1 ⇥ Paste

Nothing happens, because the =1+1 object is a QSFormulaType object, and doesn't have any other (useable) types (like NSStringPboardType).

In the future, the QSObjectHandlers protocol should also be able to implement the NSPasteboardWriting and NSPasteboardReading protocols, so that when reading/writing to the pasteboard, QSObjectHandlers themselves can just provide the right content.

Here's a proof of concept, using the current mac OS X <10.5 method, which I want to remove soon:

    // check if the primary type handler has its own method to add to the pboad
    id <QSObjectHandler> handler = [self handlerForType:[self primaryType] selector:@selector(putObject:onPasteboard:forType:)];
    if (handler) {
        [handler putObject:self onPasteboard:pboard forType:[self primaryType]];
    }

In the future, all the NSPasteboardWriting/Reading protocol methods would just call e.g.

- (NSArray *)writableTypesForPasteboard:(NSPasteboard *)pboard {
        NSMutableArray *types = [get the normal types]

    // check if the primary type handler has its own method to add to the pboad
    id <QSObjectHandler> handler = [self handlerForType:[self primaryType] selector:@selector(writableTypesForPasteboard:)];
    if (handler) {
        [types addObjectsFromArray:[handler writableTypesForPasteboard:pboard]];
    }
      return types;
}

I want to hold off on doing this until we've safely moved to OS X 10.5+ pasteboard methods

stale[bot] commented 5 months ago

This issue hasn't been updated in over 2 years. It has been marked as 'stale' and will be closed in 30 days. Please check whether this is still an issue with the latest version of Quicksilver. If so, update or comment on this issue to keep it open.