title: NSTableView hideRows leaves empty space where old rows once were
body: <p>I'm working on the ability to hide and show rows when a users taps on a button. When I call <code>NSTableView.hideRows</code> the rows do animate away as expected, but the <code>tableView</code> doesn't pull the remaining rows along with it, so a large gap is shown in the middle of the <code>tableView</code>. If I tap on an additional row, then I get the animation of the remaining rows getting pulled up.</p>
  
  <p>Images shown below...</p>
  
  <p>Table with all rows:</p>
  
  <p><a href="https://i.stack.imgur.com/31E9o.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/31E9o.png" alt="Table with all rows"></a></p>
  
  <p>Gap shown:</p>
  
  <p><a href="https://i.stack.imgur.com/BsKwv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BsKwv.png" alt="enter image description here"></a></p>
  
  <p>Code:</p>
  
  <pre><code>  func numberOfRows(in tableView: NSTableView) -&gt; Int {
      return 50
    }
  
    func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -&gt; NSView? {
      if let cell = tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier.testCell, owner: nil) as? TestCell {
        cell.label.stringValue = String(row)
        return cell
      }
      return nil
    }
  
    func tableViewSelectionDidChange(_ notification: Notification) {
      if let tableViewObject = notification.object as? NSTableView {
        let index = tableViewObject.selectedRow
        if index &gt;= 0 {
          self.tableView.hideRows(at: IndexSet(arrayLiteral: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10), withAnimation: .slideUp)
        }
      }
    }
  </code></pre>
  
  <p>Is there something I missed?</p>
  
  <p>Git link  <a href="https://gitlab.com/RollingGoron/broken-nstable" rel="nofollow noreferrer">https://gitlab.com/RollingGoron/broken-nstable</a></p>
  
  <p>****************Update*******************</p>
  
  <p>Calling <code>self.tableView.noteHeightOfRows(withIndexesChanged: range)</code> after <code>hideRows</code> fixes the problem in my example project, but doesn't solve the problem if you try and hide rows that are off screen. </p>
  
  <p>e.g. If you try and hide 100 rows, it will animate them away but instead of leaving a 100 row gap, a gap ~50 will be left depending on the size of the rows.</p>
  
  <p>I would love to see if it's possible to hideRows that are currently off screen.</p>