mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 16:22:21 +00:00
Make autotype work in more situations
The entry title will first be searched for within the window title. If the window title does not contain the entry title, then the window title will be searched for within the entry title.
This commit is contained in:
@@ -27,7 +27,7 @@ NSString *const kMPWindowTitleKey = @"windowTitle";
|
|||||||
NSString *const kMPApplciationNameKey = @"applicationName";
|
NSString *const kMPApplciationNameKey = @"applicationName";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Enabel to activate autotype
|
Enable to activate autotype
|
||||||
#define MP_AUTOTYPE
|
#define MP_AUTOTYPE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -37,8 +37,12 @@
|
|||||||
NSArray *autotypeEntries = [self.root autotypeableChildEntries];
|
NSArray *autotypeEntries = [self.root autotypeableChildEntries];
|
||||||
NSMutableArray *contexts = [[NSMutableArray alloc] initWithCapacity:MAX(1,ceil([autotypeEntries count] / 4.0))];
|
NSMutableArray *contexts = [[NSMutableArray alloc] initWithCapacity:MAX(1,ceil([autotypeEntries count] / 4.0))];
|
||||||
for(KPKEntry *entry in autotypeEntries) {
|
for(KPKEntry *entry in autotypeEntries) {
|
||||||
/* Test for title */
|
/* Test for entry title in window title */
|
||||||
NSRange titleRange = [entry.title rangeOfString:windowTitle options:NSCaseInsensitiveSearch];
|
NSRange titleRange = [windowTitle rangeOfString:entry.title options:NSCaseInsensitiveSearch];
|
||||||
|
/* Test for window title in entry title */
|
||||||
|
if (titleRange.location == NSNotFound || titleRange.length == 0) {
|
||||||
|
titleRange = [entry.title rangeOfString:windowTitle options:NSCaseInsensitiveSearch];
|
||||||
|
}
|
||||||
MPAutotypeContext *context;
|
MPAutotypeContext *context;
|
||||||
if(titleRange.location != NSNotFound && titleRange.length != 0) {
|
if(titleRange.location != NSNotFound && titleRange.length != 0) {
|
||||||
context = [[MPAutotypeContext alloc] initWithEntry:entry andSequence:entry.autotype.defaultKeystrokeSequence];
|
context = [[MPAutotypeContext alloc] initWithEntry:entry andSequence:entry.autotype.defaultKeystrokeSequence];
|
||||||
|
|||||||
Reference in New Issue
Block a user