Jump to content

Clipboard History doesn't include URLs copied from Maps.app [Fixed 3.4 b837 pre-release]


lilyball

Recommended Posts

If I search for a place in Maps and hit ⌘C, it copies both an image of the map, as well as plain text that contains a URL like https://maps.apple.com/?address=826 Folsom St, San Francisco, CA 94107, United States&auid=7989913039222126743&ll=37.781586,-122.402010&lsp=9902&q=Zero Zero&t=m. I have Alfred configured to save plain text, so I would expect Alfred's Clipboard History to retain the URL there, but it doesn't. Alfred doesn't keep any history of URLs copied from Maps.app.

 

I've tested this with "Keep Images" enabled and with it disabled, and in neither case does Alfred save the history. And I don't have Maps configured in the Ignore Apps section.

Link to comment
Share on other sites

If I press ⌘⌥C in Maps, which is just Copy Link, then Alfred clipboard history works correctly. But this produces the same pasteboard as regular Copy, just without the image. The presence of a large image shouldn't cause Alfred to skip saving the plain text.

Link to comment
Share on other sites

@kballard I've just looked into this and there is definitely something odd going on with Maps.app which initially appears to be a bug. When copying something from Maps.app, there are no types reported in the clipboard. For example, if I copy a URL from Safari (or any other Mac app), I see this:

TYPES: (
    "dyn.ah62d4rv4gu8zs3pcnzme2641rf4guzdmsv0gn64uqm10c6xenv61a3k",
    WebURLsWithTitlesPboardType,
    "dyn.ah62d4rv4gu8yc6durvwwaznwmuuha2pxsvw0e55bsmwca7d3sbwu",
    "Apple URL pasteboard type",
    "public.url",
    "CorePasteboardFlavorType 0x75726C20",
    "public.url-name",
    "CorePasteboardFlavorType 0x75726C6E",
    "public.utf8-plain-text",
    NSStringPboardType
)

And this is what I see when copying from Maps.app using cmd+c:

TYPES: (
)

... But doing a subsequent paste of this copy to e.g. TextEdit, it pastes a stack of stuff.

 

I haven't finished looking at this, but it looks like Maps.app is doing something fudgy and non-standard to get the data / URL into the clipboard. This would explain why there is different behaviour in Maps.app vs other apps.

 

Andrew

Link to comment
Share on other sites

I just tested copying from Maps and then printing out NSPasteboard.general().types and I get the expected types. So maybe it's just something weird like there being a very short delay in between you getting notified of a change (how do you get notified anyway?) and Maps actually declaring the types properly?

Link to comment
Share on other sites

Alfred watches the pasteboard change count. It looks like the change count is increased, but nothing is in the clipboard (yet), then a short period later, the data is defined in the clipboard. There is no way to achieve this using the standard pasteboard API, which is why you don't see this behaviour with other apps, so I suspect they may be doing something sketchy behind the scenes.

 

I'm not sure I want to add a fudge into Alfred to cater for this one specific case, but I will raise a bug against Maps.app.

 

Cheers,

Andrew

Link to comment
Share on other sites

What if you call `clearContents()`, then add an artificial delay, then `writeObjects()`? As long as ownership didn't change in the meantime, could this cause Alfred to see the change count increase with nothing on the pasteboard, and then have the pasteboard populate shortly afterwards?

Link to comment
Share on other sites

@kballard hmm, I had (wrongly?) assumed that this would have either been wrapped in a single pasteboard "transaction", or clearContents would have adjusted the clipboard change count (i.e. clipboard changed to empty), then writeObjects would have adjusted it too (i.e. changed to contents).

 

I've had a bit of a play with this and I can comfortably ignore clip counter changes until there are types available.

 

Thanks for highlighting this - I'll have this fixed in the next 3.4 pre-release :)

 

Cheers,

Andrew

Link to comment
Share on other sites

  • Andrew changed the title to Clipboard History doesn't include URLs copied from Maps.app [Fixed 3.4 b837 pre-release]

@Andrew Excellent. I'll check that out now. Incidentally, the first line of the change log for the pre-release has a typo ("exapnsion").

 

As for reporting it, you could do that, but I'm honestly not sure how they're supposed to know that clipboard changes are complete. I can erase the clipboard now, then write one piece of data to it, then a bit later on add more data to the clipboard, and there's no way for me to say that I'm "done" mucking with it. 

Edited by kballard
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...