mirror of
https://github.com/coteditor/CotEditor.git
synced 2024-09-11 11:25:57 +03:00
Improvve auto-quotes with multiple selections
This commit is contained in:
parent
354c98954f
commit
defda309ff
@ -24,6 +24,7 @@ develop
|
||||
- Improve invisible character drawing on a non-opaque view.
|
||||
- Change syntax style detection behavior to set “None” style if no appropriate style can be found on file opening.
|
||||
- Remove “Inline script menu items into contextual menu” option.
|
||||
- Improve auto-brackets/quotes insertion behavior with multiple selections.
|
||||
- Improve the setting file naming rule for when the name overwraps with an existing setting.
|
||||
- And some minor improvements and fixes.
|
||||
|
||||
|
@ -290,14 +290,8 @@ final class EditorTextView: NSTextView, Themable {
|
||||
{
|
||||
// wrap selection with brackets if some text is selected
|
||||
if self.selectedRange.length > 0 {
|
||||
let selectedString = (wholeString as NSString).substring(with: self.selectedRange)
|
||||
let replacementString = String(pair.begin) + selectedString + String(pair.end)
|
||||
|
||||
if self.shouldChangeText(in: self.rangeForUserTextChange, replacementString: replacementString) {
|
||||
self.replaceCharacters(in: self.rangeForUserTextChange, with: replacementString)
|
||||
self.didChangeText()
|
||||
return
|
||||
}
|
||||
self.surroundSelections(begin: String(pair.begin), end: String(pair.end))
|
||||
return
|
||||
|
||||
// check if insertion point is in a word
|
||||
} else if !CharacterSet.alphanumerics.contains(self.characterAfterInsertion ?? UnicodeScalar(0)) {
|
||||
|
Loading…
Reference in New Issue
Block a user