mirror of
https://github.com/zhigang1992/GitHawk.git
synced 2026-04-23 19:50:19 +08:00
disable and re-enable autocorrect with autocomplete, fixes #565
This commit is contained in:
@@ -214,10 +214,6 @@ IssueCommentSectionControllerDelegate {
|
||||
return autocomplete.cellHeight
|
||||
}
|
||||
|
||||
override func shouldDisableTypingSuggestionForAutoCompletion() -> Bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// MARK: Private API
|
||||
|
||||
var externalURL: URL {
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>2033</string>
|
||||
<string>2037</string>
|
||||
<key>ITSAppUsesNonExemptEncryption</key>
|
||||
<false/>
|
||||
<key>LSApplicationQueriesSchemes</key>
|
||||
|
||||
Reference in New Issue
Block a user