commit 03da4a9d522e5461f0541c94a996815af4efb637
parent af7da366c9478c0f63b04dd9d20a21ff2a75b859
Author: Dan Stillman <dstillman@zotero.org>
Date: Sun, 10 May 2015 02:40:38 -0400
Restore unselecting of last row in tree if removed
If no other rows are selected, select the row before the removed row
Diffstat:
1 file changed, 11 insertions(+), 0 deletions(-)
diff --git 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);