mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Bump date of find/replace pasteboard history items when they are used
Currently this bumping is limited to the Find dialog and happens when executing a search. Selecting from the Show Find History or subsequently using ⌘G, does not bump the date of the selected item (but probably should).
This commit is contained in:
@@ -540,17 +540,24 @@ static NSButton* OakCreateStopSearchButton ()
|
||||
if(OakNotEmptyString(_findString))
|
||||
{
|
||||
OakPasteboardEntry* oldEntry = [[OakPasteboard pasteboardWithName:NSFindPboard] current];
|
||||
if(!oldEntry || ![oldEntry.string isEqualToString:_findString])
|
||||
if(oldEntry && [oldEntry.string isEqualToString:_findString])
|
||||
{
|
||||
if(![oldEntry.options isEqualToDictionary:newOptions])
|
||||
oldEntry.options = newOptions;
|
||||
oldEntry.date = [NSDate date];
|
||||
}
|
||||
else
|
||||
{
|
||||
[[OakPasteboard pasteboardWithName:NSFindPboard] addEntryWithString:_findString andOptions:newOptions];
|
||||
else if(![oldEntry.options isEqualToDictionary:newOptions])
|
||||
oldEntry.options = newOptions;
|
||||
}
|
||||
}
|
||||
|
||||
if(_replaceString)
|
||||
{
|
||||
NSString* oldReplacement = [[[OakPasteboard pasteboardWithName:OakReplacePboard] current] string];
|
||||
if(!oldReplacement || ![oldReplacement isEqualToString:_replaceString])
|
||||
[[OakPasteboard pasteboardWithName:OakReplacePboard] addEntryWithString:_replaceString];
|
||||
OakPasteboardEntry* oldEntry = [[OakPasteboard pasteboardWithName:OakReplacePboard] current];
|
||||
if(oldEntry && [oldEntry.string isEqualToString:_replaceString])
|
||||
oldEntry.date = [NSDate date];
|
||||
else [[OakPasteboard pasteboardWithName:OakReplacePboard] addEntryWithString:_replaceString];
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
@@ -14,6 +14,7 @@ extern PUBLIC NSString* const OakFindRegularExpressionOption;
|
||||
PUBLIC @interface OakPasteboardEntry : NSManagedObject
|
||||
@property (nonatomic) NSString* string;
|
||||
@property (nonatomic) NSDictionary* options;
|
||||
@property (nonatomic) NSDate* date;
|
||||
|
||||
@property (nonatomic) BOOL fullWordMatch;
|
||||
@property (nonatomic) BOOL ignoreWhitespace;
|
||||
|
||||
@@ -21,7 +21,6 @@ NSString* const OakFindRegularExpressionOption = @"regularExpression";
|
||||
NSString* const kUserDefaultsDisablePersistentClipboardHistory = @"disablePersistentClipboardHistory";
|
||||
|
||||
@interface OakPasteboardEntry ()
|
||||
@property (nonatomic) NSDate* date;
|
||||
@property (nonatomic) OakPasteboard* pasteboard;
|
||||
@property (nonatomic) NSDictionary* primitiveOptions;
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user