diff --git a/chrome/content/zotero/xpcom/collectionTreeView.js b/chrome/content/zotero/xpcom/collectionTreeView.js index 48855b1bf6..2a0a8d1f29 100644 --- a/chrome/content/zotero/xpcom/collectionTreeView.js +++ b/chrome/content/zotero/xpcom/collectionTreeView.js @@ -281,6 +281,8 @@ Zotero.CollectionTreeView.prototype.notify = function(action, type, ids) var madeChanges = false; if (action == 'delete') { + var selectedIndex = this.selection.count ? this.selection.selectedIndex : 0; + //Since a delete involves shifting of rows, we have to do it in order //sort the ids by row @@ -324,6 +326,10 @@ Zotero.CollectionTreeView.prototype.notify = function(action, type, ids) this._refreshHashMap(); } + + if (!this.selection.count) { + this.selection.select(selectedIndex) + } } else if(action == 'move') { diff --git a/chrome/content/zotero/xpcom/itemTreeView.js b/chrome/content/zotero/xpcom/itemTreeView.js index 41e3b49b9a..1d9eb3f039 100644 --- a/chrome/content/zotero/xpcom/itemTreeView.js +++ b/chrome/content/zotero/xpcom/itemTreeView.js @@ -310,7 +310,7 @@ Zotero.ItemTreeView.prototype.notify = function(action, type, ids, extraData) // Select the last item even if there are no changes (e.g. if the tag // selector is open and already refreshed the pane) - if (splitIDs.length > 0) { + if (splitIDs.length > 0 && (action == 'add' || action == 'modify')) { var selectItem = splitIDs[splitIDs.length - 1]; } }