Fix completion of other characters than "("
@@ -1590,25 +1590,26 @@ fileprivate func parseArgs(_ args: inout [String]) {
]
for chars in completable {
- if text == chars.0 {
- textView.insertText(chars.0)
- let range = textView.selectedTextRange
- textView.insertText(chars.1)
- textView.selectedTextRange = range
-
- return false
- }
if text == chars.1 {
let range = textView.selectedRange
let nextCharRange = NSRange(location: range.location, length: 1)
let nsText = NSString(string: textView.text)
- if nsText.length > nextCharRange.location, nsText.substring(with: nextCharRange) == ")" {
+ if nsText.length > nextCharRange.location, nsText.substring(with: nextCharRange) == chars.1 {
textView.selectedTextRange = NSRange(location: range.location+1, length: 0).toTextRange(textInput: textView)
return false
}
}
+
+ if text == chars.0 {
+ textView.insertText(chars.0)
+ let range = textView.selectedTextRange
+ textView.insertText(chars.1)
+ textView.selectedTextRange = range
+
+ return false
+ }
}
if text == "\n", var currentLine = textView.currentLine, let currentLineRange = textView.currentLineRange, let selectedRange = textView.selectedTextRange {
