rem: if (gNextMessageViewIndexAfterDelete != nsMsgViewIndex_None && gNextMessageViewIndexAfterDelete >= viewSize) { if (viewSize > 0) gNextMessageViewIndexAfterDelete = viewSize - 1; else { gNextMessageViewIndexAfterDelete = nsMsgViewIndex_None;  treeSelection.clearSelection(); } } 
add: if (gNextMessageViewIndexAfterDelete == -2) {     if (treeSelection.count == 0) {    treeSelection.clearSelection(); 
context: function HandleDeleteOrMoveMessageCompleted(folder){        var treeView = gSearchView.QueryInterface(Components.interfaces.nsITreeView);        var treeSelection = treeView.selection;        viewSize = treeView.rowCount;        if (gNextMessageViewIndexAfterDelete != nsMsgViewIndex_None && gNextMessageViewIndexAfterDelete >= viewSize)        {            if (viewSize > 0)                gNextMessageViewIndexAfterDelete = viewSize - 1;            else            {                gNextMessageViewIndexAfterDelete = nsMsgViewIndex_None;                //clear the selection                treeSelection.clearSelection();            }        }        // if we are about to set the selection with a new element then DON'T clear        // the selection then add the next message to select. This just generates        // an extra round of command updating notifications that we are trying to        // optimize away.        if (gNextMessageViewIndexAfterDelete != nsMsgViewIndex_None) {            treeSelection.select(gNextMessageViewIndexAfterDelete);            // since gNextMessageViewIndexAfterDelete probably has the same value            // as the last index we had selected, the tree isn't generating a new            // selectionChanged notification for the tree view. So we aren't loading the             // next message. to fix this, force the selection changed update.            if (treeView)                treeView.selectionChanged();            EnsureRowInThreadTreeIsVisible(gNextMessageViewIndexAfterDelete);         }}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/0c9c71b1b717015f4c11f8f0886d5c3aeca764fd/SearchDialog.js/buggy/mailnews/base/search/resources/content/SearchDialog.js