rem: outlinerSelection.select(gNextMessageViewIndexAfterDelete); 
add:     if (gNextMessageViewIndexAfterDelete >= 0) outlinerSelection.select(gNextMessageViewIndexAfterDelete); 
context: function HandleDeleteOrMoveMsgCompleted(folder){  gDBView.onDeleteCompleted(true);  if (gNextMessageViewIndexAfterDelete != -2)   {    if (IsCurrentLoadedFolder(folder))     {      var outlinerView = gDBView.QueryInterface(Components.interfaces.nsIOutlinerView);      var outlinerSelection = outlinerView.selection;      if (gNextMessageViewIndexAfterDelete != nsMsgViewIndex_None)       {        viewSize = outlinerView.rowCount;        if (gNextMessageViewIndexAfterDelete >= viewSize)         {          if (viewSize > 0)            gNextMessageViewIndexAfterDelete = viewSize - 1;          else          {                       gNextMessageViewIndexAfterDelete = nsMsgViewIndex_None;            //there is nothing to select viewSize is 0            outlinerSelection.clearSelection();            setTitleFromFolder(folder,null);            ClearMessagePane();          }        }      }      // 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)       {        // when deleting a message we don't update the commands when the selection goes to 0        // (we have a hack in nsMsgDBView which prevents that update) so there is no need to        // update commands when we select the next message after the delete; the commands already        // have the right update state...        gDBView.suppressCommandUpdating = true;        outlinerSelection.select(gNextMessageViewIndexAfterDelete);                // if gNextMessageViewIndexAfterDelete has the same value         // as the last index we had selected, the outliner won't generate a        // selectionChanged notification for the outliner view. So force a manual        // selection changed call. (don't worry it's cheap if we end up calling it twice).        if (outlinerView)          outlinerView.selectionChanged();        EnsureRowInThreadOutlinerIsVisible(gNextMessageViewIndexAfterDelete);         gDBView.suppressCommandUpdating = false;      }    }      gNextMessageViewIndexAfterDelete = -2;       //default value after delete/move/copy is over  }}
meta: 5872	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/5872/f19d0ad6e5a0ad62ce5a846d44da84a39ed50186/msgMail3PaneWindow.js/buggy/mailnews/base/resources/content/msgMail3PaneWindow.js