Using jan14 commercial trunk
When you select a message in QuickSearch then clear the text, you're returned to
the folder view without any selection. This used to work.
1. Select a folder with messages (sorted by subject or date, etc. to avoid
threaded view complications).
2. Select a message or don't (results are the same either way).
3. Type text in the search bar which will yield matches.
4. Select a message in search results.
5. Backspace to clear the text from search bar.
6. You are returned to folder view with no message selected.
Actual result: no message selected when returned to folder view.
Expected: should have the message which I selected in search results shown as
selected upon return to folder view.

Created attachment 64907[details][diff][review]
proposed fix
The fix is to use SaveSelection and RestoreSelection rather than doing from
FE. This will also preserve multiple selection and has the advantage of not
reloading the message. Also this will fix sort by thread when coming out of
quick search, InitSort() was just sorting top level threads and setting
m_sortValid to true so Sort() was not being done.
It also fixes the other bug where we had to expand the thread and select the
message that was selected in QS view.
seth, can you review?

Comment on attachment 64907[details][diff][review]
proposed fix
if I'm looking at the right part of the diff, it looks OK. r=bienvenu. Please
let Seth sr since he's been working on these selection issues too.

Comment on attachment 64907[details][diff][review]
proposed fix
I only reviewed the searchBar.js and nsMsgThreadedDBView.cpp
In the future, edit patches before you attach them to make it easier on the
reviewer.
note, there are code paths in searchBar.js where you don't call
ClearThreadPaneSelection(); and ClearMessagePane();
in some code paths you return before you do that. is that desired?
if so, sr=sspitzer
make sure to test well.

Selection is now preserved if there is a selection made in quicksearch results.
If no selection made in search results, there is no selection when returned to
folder view.
OK using jaan29 commercial trunk: win98, mac OS 9.2, linux rh6.2