disable and re-enable autocorrect with autocomplete, fixes #565

This commit is contained in:
Ryan Nystrom
2017-10-14 14:21:43 -04:00
parent b0b4774dac
commit c247b55fc3
4 changed files with 12 additions and 9 deletions

View File

@@ -214,10 +214,6 @@ IssueCommentSectionControllerDelegate {
return autocomplete.cellHeight
}
override func shouldDisableTypingSuggestionForAutoCompletion() -> Bool {
return false
}
// MARK: Private API
var externalURL: URL {

View File

@@ -125,8 +125,8 @@
[newAttributedText appendAttributedString:leftAttributedString];
[newAttributedText appendAttributedString:attributedText];
[newAttributedText appendAttributedString:rightAttributedString];
[self setAttributedText:newAttributedText];
[self slk_setAttributedText:newAttributedText];
range.location += attributedText.length;
return range;
@@ -138,7 +138,7 @@
[mutableAttributeText replaceCharactersInRange:range withAttributedString:attributedText];
[self setAttributedText:mutableAttributeText];
[self slk_setAttributedText:mutableAttributeText];
range.location += self.attributedText.length;
return range;
@@ -148,6 +148,13 @@
return self.selectedRange;
}
- (void)slk_setAttributedText:(NSAttributedString *)attributedText {
const UITextAutocorrectionType previousAutocorrectionType = self.autocorrectionType;
self.autocorrectionType = UITextAutocorrectionTypeNo;
[self setAttributedText:attributedText];
self.autocorrectionType = previousAutocorrectionType;
}
- (void)slk_clearAllAttributesInRange:(NSRange)range
{
NSMutableAttributedString *mutableAttributedText = [[NSMutableAttributedString alloc] initWithAttributedString:self.attributedText];

View File

@@ -1752,7 +1752,7 @@ CGFloat const SLKAutoCompletionViewDefaultHeight = 140.0;
NSRange range = NSMakeRange(location, length);
NSRange insertionRange = [self.textView slk_insertText:string inRange:range];
self.textView.selectedRange = NSMakeRange(insertionRange.location, 0);
[self.textView slk_scrollToCaretPositonAnimated:NO];

View File

@@ -32,7 +32,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>2033</string>
<string>2037</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>