Fix highlighting extra line fragment with multi-cursor

This commit is contained in:
1024jp 2023-08-15 12:49:05 +09:00
parent fe3b39fd92
commit 9f0c7adc2f
2 changed files with 4 additions and 1 deletions

View File

@ -31,6 +31,7 @@ Change Log
### Fixes
- Fix an issue that the rectangular selection could not add an insertion point at the empty last line.
- Fix an issue that the line was not highlighted when one of multiple insertion points locates at the empty last line.

View File

@ -81,7 +81,9 @@ extension CurrentLineHighlighting {
.map(\.rangeValue)
.map { (self.string as NSString).lineRange(for: $0) }
.reduce(into: [NSRange]()) { (ranges, range) in
if ranges.last?.touches(range) == true {
if range.isEmpty && range.location == self.string.length {
ranges.append(range)
} else if ranges.last?.touches(range) == true {
ranges[ranges.count - 1].formUnion(range)
} else {
ranges.append(range)