mirror of
https://github.com/coteditor/CotEditor.git
synced 2024-10-26 10:58:05 +03:00
Workaround the Touch Bar word suggestion issue
This commit is contained in:
parent
adb57c2331
commit
56afe3fa6f
@ -14,6 +14,7 @@ develop
|
||||
### Fixes
|
||||
|
||||
- Fix an issue where UNIX scripts could fail getting the content of the document.
|
||||
- Workaround an issue where word suggestion in the Touch Bar cannot insert a word starts with a symbol correctly.
|
||||
- Address an issue where the application could crash on document saving or text replacement.
|
||||
|
||||
|
||||
|
@ -99,7 +99,12 @@ extension EditorTextViewController {
|
||||
func textView(_ textView: NSTextView, candidatesForSelectedRange selectedRange: NSRange) -> [Any]? {
|
||||
|
||||
var index = 0
|
||||
guard let candidates = textView.completions(forPartialWordRange: textView.rangeForUserCompletion, indexOfSelectedItem: &index), !candidates.isEmpty else { return nil }
|
||||
guard
|
||||
let candidates = textView.completions(forPartialWordRange: textView.rangeForUserCompletion, indexOfSelectedItem: &index)?
|
||||
.filter({ $0.range(of: "^(\\W|_)", options: .regularExpression) == nil }),
|
||||
!candidates.isEmpty
|
||||
else { return nil }
|
||||
// -> remove words start with non-alphabet to workaround a bug: e.g. "__init__" in Python (2017-10 macOS 10.13)
|
||||
|
||||
return candidates
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user