Fix last line number drawing

This commit is contained in:
1024jp 2018-11-18 16:47:21 +09:00
parent 5f2e1311c2
commit 16bc4528d5
2 changed files with 2 additions and 1 deletions

View File

@ -20,6 +20,7 @@ Change Log
### Fixes
- Address an issue where the editor area could still be tuck under the line number view.
- Fix an issue where the line number of the last empty line disappeared when lines are not wrapped and scrolled.
- [trivial] Fix a weird view expansion on the first transition to the General preferences pane.
- [trivial] Fix an issue on Mojave where the text selection highlight could remain between lines.

View File

@ -84,7 +84,7 @@ extension NSTextView {
guard includingExtraLine else { return }
let extraLineRect = layoutManager.extraLineFragmentUsedRect
if !extraLineRect.isEmpty, extraLineRect.intersects(layoutRect) {
if !extraLineRect.isEmpty, (layoutRect.minY...layoutRect.maxY).overlaps(extraLineRect.minY...extraLineRect.maxY) {
let lineNumber = max(self.string.numberOfLines(includingLastLineEnding: true), 1)
let isSelected = (selectedLineRanges.last?.location == (self.string as NSString).length)