@@ -82,25 +82,18 @@ class FoldingRibbonView: NSView {
8282 hoveringLine = model. textView? . layoutManager. textLineForPosition ( pointInView. y) ? . index
8383 }
8484
85+ /// The context in which the fold is being drawn, including the depth and fold range.
8586 struct FoldMarkerDrawingContext {
8687 let range : ClosedRange < Int >
8788 let depth : UInt
88- let hoveringLine : Int ?
8989
90- func increment( ) -> FoldMarkerDrawingContext {
90+ /// Increment the depth
91+ func incrementDepth( ) -> FoldMarkerDrawingContext {
9192 FoldMarkerDrawingContext (
9293 range: range,
93- depth: depth + 1 ,
94- hoveringLine: isHovering ( ) ? nil : hoveringLine
94+ depth: depth + 1
9595 )
9696 }
97-
98- func isHovering( ) -> Bool {
99- guard let hoveringLine else {
100- return false
101- }
102- return range. contains ( hoveringLine)
103- }
10497 }
10598
10699 override func draw( _ dirtyRect: NSRect ) {
@@ -124,7 +117,7 @@ class FoldingRibbonView: NSView {
124117 for fold in folds {
125118 drawFoldMarker (
126119 fold,
127- markerContext: FoldMarkerDrawingContext ( range: lineRange, depth: 0 , hoveringLine : hoveringLine ) ,
120+ markerContext: FoldMarkerDrawingContext ( range: lineRange, depth: 0 ) ,
128121 in: context,
129122 using: layoutManager
130123 )
@@ -156,12 +149,11 @@ class FoldingRibbonView: NSView {
156149
157150 let maxYPosition = maxPosition. yPos + maxPosition. height
158151
159- // TODO: Draw a single line when folds are adjacent
160-
161- if markerContext. isHovering ( ) {
152+ if false /*model.getCachedDepthAt(lineNumber: hoveringLine ?? -1)*/ {
162153 // TODO: Handle hover state
163154 } else {
164155 let plainRect = NSRect ( x: 0 , y: minYPosition + 1 , width: 7 , height: maxYPosition - minYPosition - 2 )
156+ // TODO: Draw a single horizontal line when folds are adjacent
165157 let roundedRect = NSBezierPath ( roundedRect: plainRect, xRadius: 3.5 , yRadius: 3.5 )
166158
167159 context. addPath ( roundedRect. cgPathFallback)
@@ -180,7 +172,7 @@ class FoldingRibbonView: NSView {
180172
181173 // Draw subfolds
182174 for subFold in fold. subFolds. filter ( { $0. lineRange. overlaps ( markerContext. range) } ) {
183- drawFoldMarker ( subFold, markerContext: markerContext. increment ( ) , in: context, using: layoutManager)
175+ drawFoldMarker ( subFold, markerContext: markerContext. incrementDepth ( ) , in: context, using: layoutManager)
184176 }
185177 }
186178
0 commit comments