Bug in NSOutlineView/NSTreeController setSelectionIndexPaths?

98 Views Asked by At

Scenario:

  • NSOutlineView with Cocoa bindings on NSTreeController. NSOutlineview selection is bound to treeController.selectionIndexPaths
  • Add 3 items in the model
  • Set selection of these new items programatically on NSTreeController
    • treeController.setSelectionIndexPaths([IndexPath(indexes: [4,0]),IndexPath(indexes: [0,0]),IndexPath(indexes: [0,1])]) // NOK
    • treeController.setSelectionIndexPaths([IndexPath(indexes: [0,0]),IndexPath(indexes: [4,0]),IndexPath(indexes: [0,1])]) // OK
    • treeController.setSelectionIndexPaths([IndexPath(indexes: [0,0]),IndexPath(indexes: [0,1]),IndexPath(indexes: [4,0])]) // OK

In the first case, the NSOutlineViewdoes not select the right item. The [4,0] item is not selected, instead the [3,0] is selected. The selection is actually correct in the treeController because when I delete the items in the selection of the treeController, the right items are removed.

This is the OutlineView not properly reflecting the TreeController's selection in a specific case.

This looks like a bug to me, but I'm asking your expert advice to know if I did something wrong here.

Thanks!

0

There are 0 best solutions below