Fix instance highlighting when selecting multiple lines (fix #1090)

This commit is contained in:
1024jp 2020-07-15 15:08:16 +09:00
parent 88add69c14
commit 4f12df91dd
2 changed files with 5 additions and 1 deletions

View File

@ -9,6 +9,10 @@ Change Log
- [trivial] Tweak some UI styles.
### Fixes
- Fix an issue in the instant highlighting that the highlight shape spread wrongly when the selected text included line breaks.
3.9.2 (425)

View File

@ -1604,7 +1604,7 @@ final class EditorTextView: NSTextView, Themable, CurrentLineHighlighting, URLDe
self.insertionLocations.isEmpty,
self.selectedRanges.count == 1,
!self.selectedRange.isEmpty,
(try! NSRegularExpression(pattern: "^\\b\\w.*\\w\\b$"))
(try! NSRegularExpression(pattern: "\\A\\b\\w.*\\w\\b\\z"))
.firstMatch(in: self.string, options: [.withTransparentBounds], range: self.selectedRange) != nil
else { return }