mirror of
https://github.com/coteditor/CotEditor.git
synced 2024-09-11 11:25:57 +03:00
Fix drawing last line number
This commit is contained in:
parent
155fe10ab5
commit
51606ed728
@ -13,6 +13,11 @@ Change Log
|
||||
- Change the label of the option “Count each line ending as one character” in General pane to “Ignore line endings when counting characters” (the value reversed).
|
||||
|
||||
|
||||
### Fixes
|
||||
|
||||
- [trivial] Fix a potential issue where last empty line number could be drawn at the first line position under specific condition.
|
||||
|
||||
|
||||
|
||||
3.6.9 (305)
|
||||
--------------------------
|
||||
|
@ -84,13 +84,17 @@ extension NSTextView {
|
||||
|
||||
guard includingExtraLine else { return }
|
||||
|
||||
let extraLineRect = layoutManager.extraLineFragmentUsedRect
|
||||
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)
|
||||
|
||||
body(.new(lineNumber, isSelected), extraLineRect)
|
||||
}
|
||||
let extraLineRect = layoutManager.extraLineFragmentRect
|
||||
|
||||
guard
|
||||
!extraLineRect.isEmpty,
|
||||
(layoutRect.minY...layoutRect.maxY).overlaps(extraLineRect.minY...extraLineRect.maxY)
|
||||
else { return }
|
||||
|
||||
lineNumber = max(self.string.numberOfLines(includingLastLineEnding: true), 1)
|
||||
let isSelected = (selectedLineRanges.last?.location == (self.string as NSString).length)
|
||||
|
||||
body(.new(lineNumber, isSelected), extraLineRect)
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user