Fixed regression resutling in to aggressive command convertion to upper cases

This commit is contained in:
michael starke
2014-12-08 22:16:12 +01:00
parent 195f533940
commit 78447e4a6d

View File

@@ -135,7 +135,7 @@
} }
} }
/* Test for modifer Key */ /* Test for modifer Key */
NSString *commandString = [[context.evaluatedCommand substringWithRange:commandRange] uppercaseString]; NSString *commandString = [context.evaluatedCommand substringWithRange:commandRange];
/* append commands for non-modifer keys */ /* append commands for non-modifer keys */
if(![self updateModifierMask:&collectedModifers forCommand:commandString]) { if(![self updateModifierMask:&collectedModifers forCommand:commandString]) {
[self appendCommandForEntry:context.entry withString:commandString toCommands:commands activeModifer:collectedModifers]; [self appendCommandForEntry:context.entry withString:commandString toCommands:commands activeModifer:collectedModifers];
@@ -248,14 +248,15 @@
return; // Nothing to parse return; // Nothing to parse
} }
/* Simple Special Press */ /* Simple Special Press */
NSNumber *keyCodeNumber = [self keypressCommands][commandString]; NSString *uppercaseCommand = commandString.uppercaseString;
NSNumber *keyCodeNumber = [self keypressCommands][uppercaseCommand];
if(nil != keyCodeNumber) { if(nil != keyCodeNumber) {
CGKeyCode keyCode = [keyCodeNumber keyCodeValue]; CGKeyCode keyCode = [keyCodeNumber keyCodeValue];
[commands addObject:[[MPAutotypeKeyPress alloc] initWithModifierMask:flags keyCode:keyCode]]; [commands addObject:[[MPAutotypeKeyPress alloc] initWithModifierMask:flags keyCode:keyCode]];
return; // Done return; // Done
} }
/* Clearfield */ /* Clearfield */
if([kKPKAutotypeClearField isEqualToString:commandString]) { if([kKPKAutotypeClearField isEqualToString:uppercaseCommand]) {
[commands addObject:[[MPAutotypeClear alloc] init]]; [commands addObject:[[MPAutotypeClear alloc] init]];
return; // Done return; // Done
} }
@@ -270,19 +271,19 @@
NSAssert(delayRegExp, @"Regex for delay should work!"); NSAssert(delayRegExp, @"Regex for delay should work!");
NSTextCheckingResult *result = [delayRegExp firstMatchInString:commandString options:0 range:NSMakeRange(0, [commandString length])]; NSTextCheckingResult *result = [delayRegExp firstMatchInString:commandString options:0 range:NSMakeRange(0, [commandString length])];
if(result && (result.numberOfRanges == 3)) { if(result && (result.numberOfRanges == 3)) {
NSString *command = [commandString substringWithRange:[result rangeAtIndex:1]]; NSString *uppercaseCommand = [[commandString substringWithRange:[result rangeAtIndex:1]] uppercaseString];
NSString *valueString = [commandString substringWithRange:[result rangeAtIndex:2]]; NSString *valueString = [commandString substringWithRange:[result rangeAtIndex:2]];
NSScanner *numberScanner = [[NSScanner alloc] initWithString:valueString]; NSScanner *numberScanner = [[NSScanner alloc] initWithString:valueString];
NSInteger value; NSInteger value;
if([numberScanner scanInteger:&value]) { if([numberScanner scanInteger:&value]) {
if([kKPKAutotypeDelay isEqualToString:command]) { if([kKPKAutotypeDelay isEqualToString:uppercaseCommand]) {
if(MAX(0, value) <= 0) { if(MAX(0, value) <= 0) {
return; // Value too low, just skipp return; // Value too low, just skipp
} }
[commands addObject:[[MPAutotypeDelay alloc] initWithDelay:value]]; [commands addObject:[[MPAutotypeDelay alloc] initWithDelay:value]];
return; // Done return; // Done
} }
else if([kKPKAutotypeVirtualKey isEqualToString:command]) { else if([kKPKAutotypeVirtualKey isEqualToString:uppercaseCommand]) {
NSLog(@"Virtual key strokes aren't supported yet!"); NSLog(@"Virtual key strokes aren't supported yet!");
// TODO add key // TODO add key
} }
@@ -301,7 +302,7 @@
if(mask == NULL) { if(mask == NULL) {
return NO; return NO;
} }
NSNumber *flagNumber = [self modifierCommands][commandString]; NSNumber *flagNumber = [self modifierCommands][commandString.uppercaseString];
if(!flagNumber) { if(!flagNumber) {
return NO; // No modifier key, just leave return NO; // No modifier key, just leave
} }