mirror of
https://github.com/textmate/textmate.git
synced 2026-01-21 04:38:13 -05:00
Do not add transient pasteboard items to history
See http://nspasteboard.org for details.
This commit is contained in:
@@ -192,6 +192,10 @@ namespace
|
||||
D(DBF_Pasteboard, bug("new data: %s (%zd = %zd)\n", BSTR((_changeCount != [[self pasteboard] changeCount])), (ssize_t)_changeCount, (ssize_t)[[self pasteboard] changeCount]););
|
||||
if(_changeCount != [[self pasteboard] changeCount])
|
||||
{
|
||||
// Do not add to history, see http://nspasteboard.org
|
||||
if([[self pasteboard] availableTypeFromArray:@[ @"org.nspasteboard.TransientType", @"org.nspasteboard.ConcealedType", @"org.nspasteboard.AutoGeneratedType" ]])
|
||||
return;
|
||||
|
||||
NSString* onClipboard = [[self pasteboard] availableTypeFromArray:@[ NSStringPboardType ]] ? [[self pasteboard] stringForType:NSStringPboardType] : nil;
|
||||
NSString* onStack = [([_entries count] == 0 ? nil : _entries[_index]) string];
|
||||
_changeCount = [[self pasteboard] changeCount];
|
||||
@@ -307,7 +311,7 @@ namespace
|
||||
_index = [_entries count]-1;
|
||||
_auxiliaryOptionsForCurrent = nil;
|
||||
}
|
||||
else if(!_avoidsDuplicates || ![[self current] isEqual:anEntry])
|
||||
else if(!_avoidsDuplicates || ![_entries count] || ![_entries[_index] isEqual:anEntry])
|
||||
{
|
||||
[_entries addObject:anEntry];
|
||||
[self setIndex:[_entries count]-1];
|
||||
@@ -327,6 +331,11 @@ namespace
|
||||
{
|
||||
D(DBF_Pasteboard, bug("%zu / %zu\n", (size_t)_index, (size_t)[_entries count]););
|
||||
[self checkForExternalPasteboardChanges];
|
||||
if([[self pasteboard] availableTypeFromArray:@[ @"org.nspasteboard.TransientType", @"org.nspasteboard.ConcealedType", @"org.nspasteboard.AutoGeneratedType" ]])
|
||||
{
|
||||
if(NSString* onClipboard = [[self pasteboard] availableTypeFromArray:@[ NSStringPboardType ]] ? [[self pasteboard] stringForType:NSStringPboardType] : nil)
|
||||
return [OakPasteboardEntry pasteboardEntryWithString:onClipboard andOptions:[[self pasteboard] availableTypeFromArray:@[ OakPasteboardOptionsPboardType ]] ? [[self pasteboard] propertyListForType:OakPasteboardOptionsPboardType] : nil];
|
||||
}
|
||||
return [_entries count] == 0 ? nil : _entries[_index];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user