From 4af8e0ab1cfda62aa7b9008d85e9b9274dd2687a Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Fri, 10 Jul 2020 16:49:10 -0500 Subject: [PATCH] Select next item in Sidebar on delete. Issue #2114 --- Mac/MainWindow/Sidebar/SidebarViewController.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Mac/MainWindow/Sidebar/SidebarViewController.swift b/Mac/MainWindow/Sidebar/SidebarViewController.swift index d3f468ba4..c0008daa2 100644 --- a/Mac/MainWindow/Sidebar/SidebarViewController.swift +++ b/Mac/MainWindow/Sidebar/SidebarViewController.swift @@ -223,7 +223,11 @@ protocol SidebarDelegate: class { if outlineView.selectionIsEmpty { return } + let firstRow = outlineView.selectedRowIndexes.min() deleteNodes(selectedNodes) + if let restoreRow = firstRow, restoreRow < outlineView.numberOfRows { + outlineView.selectRow(restoreRow) + } } @IBAction func doubleClickedSidebar(_ sender: Any?) {