I think I now have a solution that should cover all cases, while being both simple and backward-compatible with legacy approaches.
I therefore would like to make the following proposal. I'll start from scratch, as if no other solutions existed yet. After that, I'll shows how it affects producers and consumers. And finally, I'll make a suggestion how we can implement all this with a minimum of effort and changes to existing practice.
Let's start with a marker that I will call "OffRecord" for now. When a producer includes that in the clipboard, it does not want any consumers to record that. Historians and similar tools should simply ignore these clipboards, ideally by looking only at the flavors, without fetching the actual data.
How does this affect typical use cases?
1. Typinator- and TextExpander-like expansions:
save clipboard (content A)
fill clipboard (with OffRecord), paste
... (possibly repeated multiple times)
restore clipboard (A + OffRecord)
Historians will ignore the entire sequence. The last "official" clipboard contents that they saw is A, and this is still there at the end of the sequence.
2. Macro tool or similar utility:
fills the clipboard with new content.
The producer must decide whether the new content should appear in a clipboard history or not. Depending on this decision, it should include OffRecord or not.
3. Password utility:
If the tool puts things on the clipboard that should not show up in any clipboard history, they should simply include OffRecord. This applies to passwords, credit card numbers and secret notes alike.
There is only one situation where an additional marker is needed: When a history tool (or similar, like the good old scrapbook) restores an OLDER version of the clipboard, it can include a RestoredType marker, where the data should indicate the source (TBD: how; which change count; how to deal with data from older sessions?)
Note that the RestoredType marker should normally NOT be used in a sequence of "OffRecord" clips, where the last restores the state immediately before the sequence.
The RestoredType marker will be useful when one or more clipboard utilities coexist. When one of them restores older content, it can tell the others about the fact. All other utilities can safely ignore RestoredType markers. For example, when Typinator would save a clipboard with a RestoredType marker, it would later restore that clipboard as it was, including the RestoredType marker (and plus an additional OffRecord marker). This means that clipboard utilities should first check for OffRecord and check for RestoredType only if OffRecord is missing.
When a historian temporarily uses the clipboard for pasting a previous copy of the clipboard, it does NOT need to mark that with RestoredType. Instead, it should save the clipboard, paste the older clipboard with the OffRecord flag, and then restore the original clipboard, again with OffRecord.
That's it. In my opinion, OffRecord and RestoredType should suffice. In particular, AutoGeneratedType should be dropped. Likewise, ConcealedType is not needed, as OffRecord covers that, too.
This brings us to the question how OffRecord should actually be represented. Instead of introducing yet another type, I would propose to use org.nspasteboard.TransientType for this, even though the name is misleading. The point is that this flavor is already established and has been used for a while. The semantics may be slightly different, but in my opinion, the TransientType marker has been used in this sense, anyway.
Typinator would continue to use the legacy flavors (in particular, "Pasteboard generator type") along with "org.nspasteboard.TransientType", and other producers will probably do the same. This should not create any conflicts.
To summarize:
- org.nspasteboard.TransientType shall be used to tell other utilities not to save this clipboard content.
- org.nspasteboard.RestoredType shall be used to tell other utilities that the current clipboard content is a copy of older content.
- When both org.nspasteboard.TransientType and org.nspasteboard.RestoredType are present, the latter shall be ignored.
- org.nspasteboard.AutoGeneratedType and org.nspasteboard.ConcealedType shall be dropped.
- Clipboard contents with the org.nspasteboard.TransientType flavor can be anything, including empty. Consumers must not expect any particular content.
- Clipboard contents with the org.nspasteboard.RestoredType flavor shall identify the original version of the clipboard data. The exact content is to be defined.
Questions to all participants:
- Would this work for you?
- Do you need additional information?
- Would this break your existing code?
- What should be contained in a RestoredType marker?
Cheers,
gue