mirror of
https://github.com/objective-see/TaskExplorer.git
synced 2026-03-22 07:02:39 +00:00
filter background processing support for filtering when enter is hit after trying full #keyword 'not found' binary attribute/#keyword error alert when opening file in Finder fails skipper dylib/file/network enumeration for kernel task (pid 0x0)
68 lines
1.5 KiB
Objective-C
68 lines
1.5 KiB
Objective-C
//
|
|
// CustomTextField.m
|
|
// SearchField
|
|
//
|
|
// Created by Patrick Wardle on 8/27/15.
|
|
//
|
|
//
|
|
|
|
#import "CustomTextField.h"
|
|
#import "AppDelegate.h"
|
|
|
|
@implementation CustomTextField
|
|
|
|
@synthesize owner;
|
|
@synthesize lastMovement;
|
|
|
|
//subclass override
|
|
// ->see: http://stackoverflow.com/questions/5163646/how-to-make-nssearchfield-send-action-upon-autocompletion/5360535#5360535
|
|
-(void)insertCompletion:(NSString *)word forPartialWordRange:(NSRange)charRange movement:(NSInteger)movement isFinal:(BOOL)flag
|
|
{
|
|
//suppress completion if user types a space
|
|
if(movement == NSRightTextMovement)
|
|
{
|
|
//bail
|
|
goto bail;
|
|
}
|
|
|
|
//ignore if 2x 'enter'
|
|
if( (movement == NSReturnTextMovement) &&
|
|
(self.lastMovement == NSReturnTextMovement) )
|
|
{
|
|
//bail
|
|
goto bail;
|
|
}
|
|
|
|
//update
|
|
self.lastMovement = movement;
|
|
|
|
//show full replacements
|
|
if(0 != charRange.location)
|
|
{
|
|
//update length
|
|
charRange.length += charRange.location;
|
|
|
|
//reset location
|
|
charRange.location = 0;
|
|
}
|
|
|
|
//insert completion
|
|
// ->will use updated char range!
|
|
[super insertCompletion:word forPartialWordRange:charRange movement:movement isFinal:flag];
|
|
|
|
//on enter
|
|
// ->call up into app delegate to process (filter)
|
|
if(movement == NSReturnTextMovement)
|
|
{
|
|
//call up into owner to process
|
|
[owner filterAutoComplete:self];
|
|
}
|
|
|
|
//bail
|
|
bail:
|
|
|
|
return;
|
|
}
|
|
|
|
@end
|