@@ -210,25 +210,37 @@ extension FindNavigatorListViewController: NSOutlineViewDelegate {
210
210
211
211
func outlineView( _ outlineView: NSOutlineView , heightOfRowByItem item: Any ) -> CGFloat {
212
212
if let item = item as? SearchResultMatchModel {
213
+ let columnWidth = outlineView. tableColumns. first? . width ?? outlineView. frame. width
214
+ let indentationLevel = outlineView. level ( forItem: item)
215
+ let indentationSpace = CGFloat ( indentationLevel) * outlineView. indentationPerLevel
216
+ let availableWidth = columnWidth - indentationSpace - 24
217
+
218
+ // Create a temporary text field for measurement
213
219
let tempView = NSTextField ( wrappingLabelWithString: item. attributedLabel ( ) . string)
214
220
tempView. allowsDefaultTighteningForTruncation = false
215
221
tempView. cell? . truncatesLastVisibleLine = true
216
222
tempView. cell? . wraps = true
217
- tempView. maximumNumberOfLines = 3
218
- tempView. attributedStringValue = item. attributedLabel ( )
219
- tempView. layout ( )
220
- let width = outlineView. frame. width - outlineView. indentationPerLevel*2 - 24
221
- return tempView. sizeThatFits (
222
- NSSize ( width: width, height: CGFloat . greatestFiniteMagnitude)
223
- ) . height + 8
224
- } else {
225
- return rowHeight
223
+ tempView. maximumNumberOfLines = Settings . shared. preferences. general. findNavigatorDetail. rawValue
224
+ tempView. preferredMaxLayoutWidth = availableWidth
225
+
226
+ let height = tempView. sizeThatFits (
227
+ NSSize ( width: availableWidth, height: CGFloat . greatestFiniteMagnitude)
228
+ ) . height
229
+ return max ( height + 8 , rowHeight)
226
230
}
231
+ return rowHeight
227
232
}
228
233
229
234
func outlineViewColumnDidResize( _ notification: Notification ) {
235
+ // Disable animations temporarily
236
+ NSAnimationContext . beginGrouping ( )
237
+ NSAnimationContext . current. duration = 0
238
+
230
239
let indexes = IndexSet ( integersIn: 0 ..< searchItems. count)
231
240
outlineView. noteHeightOfRows ( withIndexesChanged: indexes)
241
+
242
+ NSAnimationContext . endGrouping ( )
243
+ outlineView. layoutSubtreeIfNeeded ( )
232
244
}
233
245
}
234
246
0 commit comments