From 03da4a9d522e5461f0541c94a996815af4efb637 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sun, 10 May 2015 02:40:38 -0400 Subject: [PATCH] Restore unselecting of last row in tree if removed If no other rows are selected, select the row before the removed row --- chrome/content/zotero/xpcom/libraryTreeView.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/chrome/content/zotero/xpcom/libraryTreeView.js b/chrome/content/zotero/xpcom/libraryTreeView.js index a8cfba52c..18bbd906c 100644 --- a/chrome/content/zotero/xpcom/libraryTreeView.js +++ b/chrome/content/zotero/xpcom/libraryTreeView.js @@ -103,6 +103,17 @@ Zotero.LibraryTreeView.prototype = { */ _removeRow: function (row, skipMapUpdate) { var id = this._rows[row].id; + + var lastRow = row == this.rowCount - 1; + if (lastRow && this.selection.isSelected(row)) { + // Deslect removed row + this.selection.toggleSelect(row); + // If no other rows selected, select row before + if (this.selection.count == 0 && row !== 0) { + this.selection.toggleSelect(row - 1); + } + } + this._rows.splice(row, 1); this.rowCount--; this._treebox.rowCountChanged(row + 1, -1);