Fixed autotype for fields containing curly brackets

This commit is contained in:
michael starke
2014-08-20 01:24:36 +02:00
parent 4acfde5117
commit 472289f7d7
2 changed files with 15 additions and 6 deletions

View File

@@ -99,7 +99,7 @@
NSUInteger reserverd = MAX(1,[context.normalizedCommand length] / 4);
NSMutableArray *commands = [[NSMutableArray alloc] initWithCapacity:reserverd];
NSMutableArray __block *commandRanges = [[NSMutableArray alloc] initWithCapacity:reserverd];
NSRegularExpression *commandRegExp = [[NSRegularExpression alloc] initWithPattern:@"\\{[^\\}]+\\}" options:NSRegularExpressionCaseInsensitive error:0];
NSRegularExpression *commandRegExp = [[NSRegularExpression alloc] initWithPattern:@"\\{[^\\{\\}]+\\}" options:NSRegularExpressionCaseInsensitive error:0];
NSAssert(commandRegExp, @"RegExp is constant. Has to work all the time");
[commandRegExp enumerateMatchesInString:context.evaluatedCommand options:0 range:NSMakeRange(0, [context.evaluatedCommand length]) usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) {
@autoreleasepool {
@@ -160,6 +160,9 @@
if(!commandString) {
return;
}
/* TODO: Test for special Commands */
/* TODO: fall back to paste if nothing matches */
NSNumber *keyCodeNumber = [self keypressCommands][commandString];
@@ -167,6 +170,9 @@
CGKeyCode keyCode = [keyCodeNumber keyCodeValue];
[commands addObject:[[MPAutotypeKeyPress alloc] initWithModifierMask:flags keyCode:keyCode]];
}
else {
[self appendPasteCommandForContent:commandString toCommands:commands];
}
}
+ (BOOL)updateModifierMask:(CGEventFlags *)mask forCommand:(NSString *)commandString {