completeWords |
- ( BOOL ) completeWords;
Returns whether completion uses word boundaries or the entire text before the selection as the match prefix. YES by default. If YES, completion is done by word (where "word" means all characters from the selection back to the first whitespace character prior to the selection), if NO completion always uses the whole text (back to startLimit). It is a good idea to set this to NO for text fields that hold a single path since it lets the completion work on paths with spaces in them.
completionStrategies |
- ( NSArray *) completionStrategies;
This method returns the array of MOCompletionStrategy instances that the receiver uses to implement its completion behavior.
control:textView:doCommandBySelector: |
- ( BOOL ) control: (NSControl *) control textView: (NSTextView *) textView doCommandBySelector: (SEL ) commandSelector;
This NSControl delegate method is implemented in case the MOCompletionManager is used directly as the delegate of an NSControl. It is implemented to call -doCompletionInTextView:startLimit:basePath: if the selector is -complete. It passes textView as the textView, 0 as the startLimit, and nil for basePath.
- control
- The control.
- textView
- The textView.
- commandSelector
- The selector being performed. This method looks for -complete:.
controlTextDidChange: |
- ( void ) controlTextDidChange: (NSNotification *) notification;
This NSControl delegate method is implemented in case the MOCompletionManager is used directly as the delegate of an NSControl. It is implemented to call -dumpCompletionState.
- notification
- The notification.
controlTextDidEndEditing: |
- ( void ) controlTextDidEndEditing: (NSNotification *) notification;
This NSControl delegate method is implemented in case the MOCompletionManager is used directly as the delegate of an NSControl. It is implemented to call -dumpCompletionState.
- notification
- The notification.
doCompletionInTextView:startLimit:basePath: |
- ( void ) doCompletionInTextView: (NSTextView *) textView startLimit: (unsigned ) startLimit basePath: (NSString *) basePath;
This method is the main entry point for MOCompletionManager. It is called automatically from MOCompletionManager's implementation of -textView:doCommandBySelector: and -control:textView:doCommandBySelector: if the selector passed in is -complete:. You should call this method from your own implementation of the methods above if your own object, instead of the MOCompletionManager, is the delegate of the text view or control doing the completion.
This method relies on state stored by the MOCompletionManager and on the receiver's MOCompletionStrategy instances to perform its job. The first thing it does is check if any existing state has become stale because the textView, selection range, or basePath have changed since the last completion. If the existing state is stale, it is dumped by calling -dumpCompletionState. Next, if there's no stored state (either because it was just dumped or because there just wasn't any), the proper prefix completion string is calculated and then the MOCompletionStrategy instances are given a chance, in order, to come up with possible completions. The first MOCompletionStrategy that returns any completions is the one that gets used.
Finally, a completion is chosen and inserted into the text view at the selection. For the first completion after new completions have been calculated, the completion used is the longest common prefix of all the possible completions. Subsequent completions will cycle through the possible completions.
- textView
- The NSTextView to do the completion in.
- startLimit
- Usually 0, this allows specifying a backwards limit when scanning the text for a suitable completion prefix.
- basePath
- This is simply passed through to the MOCompletionStrategy instances. It is normally used for path-based completion to provide a base to evaluate relative paths against. In MOCompletionManager's implementations of -textView:doCommandBySelector: and -control:textView:doCommandBySelector:, the basePath passed to this method is nil.
dumpCompletionState |
- ( void ) dumpCompletionState;
This method discards any stored state that the MOCompletionManager uses to provide cycling through multiple completions. It is called automatically, sometimes, if MOCompletionManager detects that the stored state is stale and that a new new completion state should be calculated. This happens, for example, if completion is requested for a different NSTextView from the last completion or if the selection range or base path has changed since the last completion. It is also called automatically following a successful completion that had only a single match. Finally, it is automatically called from MOCompletionManager's implementations of -textDidChange:, -textDidEndEditing:, -controlTextDidChange: and -controlTextDidEndEditing:. You should call this method from your own implementation of the methods above if your own object, instead of the MOCompletionManager, is the delegate of the text view or control doing the completion.
setCompleteWords: |
- ( void ) setCompleteWords: (BOOL ) flag;
Sets whether completion uses word boundaries or the entire text before the selection as the match prefix. YES by default. If YES, completion is done by word (where "word" means all characters from the selection back to the first whitespace character prior to the selection), if NO completion always uses the whole text (back to startLimit). It is a good idea to set this to NO for text fields that hold a single path since it lets the completion work on paths with spaces in them.
- flag
- Whether to parse match prefixes using word boundaries.
setCompletionStrategies: |
- ( void ) setCompletionStrategies: (NSArray *) strategies;
This method sets the array of MOCompletionStrategy instances that the receiver should use to implement its completion behavior. If a MOCompletionManager has more thyan one completion strategy, each time a new completion is being done, the strategies are tried in order and the first one that returns any matches is used. Matches from multiple strategies are NOT mixed together.
- strategies
- The NSArray of MOCompletionStrategy instances.
textDidChange: |
- ( void ) textDidChange: (NSNotification *) notification;
This NSTextView delegate method is implemented in case the MOCompletionManager is used directly as the delegate of an NSTextView. It is implemented to call -dumpCompletionState.
- notification
- The notification.
textDidEndEditing: |
- ( void ) textDidEndEditing: (NSNotification *) notification;
This NSTextView delegate method is implemented in case the MOCompletionManager is used directly as the delegate of an NSTextView. It is implemented to call -dumpCompletionState.
- notification
- The notification.
textView:doCommandBySelector: |
- ( BOOL ) textView: (NSTextView *) textView doCommandBySelector: (SEL ) commandSelector;
This NSTextView delegate method is implemented in case the MOCompletionManager is used directly as the delegate of an NSTextView. It is implemented to call -doCompletionInTextView:startLimit:basePath: if the selector is -complete. It passes textView as the textView, 0 as the startLimit, and nil for basePath.
- textView
- The textView.
- commandSelector
- The selector being performed. This method looks for -complete:.
(Last Updated 3/20/2005)