                         drawTick(y: y)
                     }
                     if !isVerticalText || lineNumber % 5 == 0 || lineNumber == 1 || isSelected ||
-                        lineRange.upperBound == length && layoutManager.extraLineFragmentTextContainer == nil  // last line for vertical text
+                        (lineRange.upperBound == length && layoutManager.extraLineFragmentTextContainer == nil)  // last line for vertical text
                     {
                         drawLineNumber(lineNumber, y: y, isBold: isSelected)
                     }

                    (!isVerticalText || (lineRange.location == selectedRange.location || lineRange.upperBound == selectedRange.upperBound)))
            }
            
            while glyphCount < glyphIndex {  // handle wrapper lines
                var range = NSRange.notFound
                let lineRect = layoutManager.lineFragmentRect(forGlyphAt: glyphCount, effectiveRange: &range, withoutAdditionalLayout: true)
                let isWrappedLine = (lastLineNumber == lineNumber)
                lastLineNumber = lineNumber
                glyphCount = range.upperBound
                
                if isVerticalText, isWrappedLine { continue }
                
                let y = scale * -lineRect.minY
                
                if isWrappedLine {
                    drawWrappedMark(y: y)
                    
                } else {  // new line

        // draw the last "extra" line number
        if layoutManager.extraLineFragmentTextContainer != nil {
            let isSelected: Bool = {
                guard let lastSelectedRange = selectedLineRanges.last else { return false }
                
                return (lastSelectedRange.length == 0) && (length == lastSelectedRange.upperBound)
            }()
            let lineRect = layoutManager.extraLineFragmentUsedRect
            let y = scale * -lineRect.minY
