Fix unwanted completion list (fix #468)

This commit is contained in:
1024jp 2015-11-08 01:41:14 +09:00
parent aef17c3146
commit 254c571236
2 changed files with 4 additions and 0 deletions

View File

@ -18,6 +18,7 @@ Change Log
### Fixes
- Fix an issue where some type of script file cannot be opened because of “unidentified developer” alert even it was made on CotEditor.
- Fix an issue where unwanted completion list was displayed by auto-completion when after typing a symbol character.

View File

@ -349,6 +349,9 @@
- (nonnull NSArray<NSString *> *)textView:(nonnull NSTextView *)textView completions:(nonnull NSArray<NSString *> *)words forPartialWordRange:(NSRange)charRange indexOfSelectedItem:(nullable NSInteger *)index
// ------------------------------------------------------
{
// do nothing if completion is not suggested from the typed characters
if (charRange.length == 0) { return @[]; }
NSMutableOrderedSet<NSString *> *candidateWords = [NSMutableOrderedSet orderedSet];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *partialWord = [[textView string] substringWithRange:charRange];