mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-23 00:49:32 +00:00
Removed duplicate paste commands for autotype
This commit is contained in:
@@ -151,8 +151,14 @@
|
||||
|
||||
+ (void)appendPasteCommandForContent:(NSString *)pasteContent toCommands:(NSMutableArray *)commands {
|
||||
if(pasteContent) {
|
||||
MPAutotypePaste *pasteCommand = [[MPAutotypePaste alloc] initWithString:pasteContent];
|
||||
[commands addObject:pasteCommand];
|
||||
/* Update an already inserted paste command with the new conents */
|
||||
if([[commands lastObject] isKindOfClass:[MPAutotypePaste class]]) {
|
||||
[[commands lastObject] appendString:pasteContent];
|
||||
}
|
||||
else {
|
||||
MPAutotypePaste *pasteCommand = [[MPAutotypePaste alloc] initWithString:pasteContent];
|
||||
[commands addObject:pasteCommand];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,5 +14,6 @@
|
||||
@interface MPAutotypePaste : MPAutotypeCommand
|
||||
|
||||
- (instancetype)initWithString:(NSString *)aString;
|
||||
- (void)appendString:(NSString *)aString;
|
||||
|
||||
@end
|
||||
@@ -27,6 +27,11 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)appendString:(NSString *)aString {
|
||||
self.pasteData = [self.pasteData stringByAppendingString:aString];
|
||||
}
|
||||
|
||||
|
||||
- (void)execute {
|
||||
if([self.pasteData length] > 0) {
|
||||
MPPasteBoardController *controller = [MPPasteBoardController defaultController];
|
||||
@@ -40,4 +45,6 @@
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user