After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 332765 - auto-selection of the first message is annoying
auto-selection of the first message is annoying
Status: RESOLVED FIXED
Product: evolution
Classification: Applications
Component: Mailer
2.6.x (obsolete)
Other All
: Normal minor
: ---
Assigned To: evolution-mail-maintainers
Evolution QA team
: 343887 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2006-02-27 17:38 UTC by Jeffrey Stedfast
Modified: 2013-09-13 00:48 UTC
See Also:
GNOME target: ---
GNOME version: 2.11/2.12


Attachments
bugfix (1.08 KB, patch)
2007-03-12 11:51 UTC, Christof Krüger
reviewed Details | Review
bugfix revision 2 (3.79 KB, patch)
2007-03-15 14:38 UTC, Christof Krüger
committed Details | Review

Description Jeffrey Stedfast 2006-02-27 17:38:33 UTC
if I delete and expunge the last message in the message-list, the message-list
gets scrolled to the very top and the first message is auto-selected. this is
very annoying because new mail always appears at the end of my message-list when
it arrives. This means I have to scroll again (not a huge catastrophe, sure, but
annoying because I can't see the subjects of the new mail until I scroll)

the old behaviour was such that if the selected message was deleted/expunged, it
wouldn't auto-force-select the first message and so it didn't scroll back to the
top. This was much preferred...

One possible fix to this if a emssage has to be selected would be to select the
closest message to the one that had been deleted/expunged-while-selected. If
there's a message afterward, select it - if not, select the message previous to
the one expunge?

Other information:
Comment 1 Elijah Newren 2006-06-05 16:48:13 UTC
*** Bug 343887 has been marked as a duplicate of this bug. ***
Comment 2 Elijah Newren 2006-06-05 16:53:03 UTC
This has really been bugging me as well...
Comment 3 Mikhail Zabaluev 2006-10-02 19:20:39 UTC
The behaviour that I see with 2.8.0 is different: when a selected message is deleted and removed from the list, the selection disappears instead of moving to the next message, as it did in 2.6. The scrolling position does not change. It's still annoying, as I can't easily browse my mail folders anymore using the keyboard alone. After I hit Delete and try to select the next message with the Down arrow key, the selection moves to the beginning of the list.
Comment 4 Christof Krüger 2006-10-02 23:30:45 UTC
Mikhail:
I can't reproduce it with 2.8.0. It happened with 2.6 for me but now it's working (Ubuntu Edgy Beta).

However, if I move the last (bottom-most) message to another folder, no selection is made. Therefore, when I switch to another folder and then switch back to the original folder, the view is scrolled way back up to the very top.

It works correctly when moving not the bottom-most message.
Comment 5 Christof Krüger 2006-10-02 23:38:52 UTC
Sorry for comment-spamming but I have to make an addition to my previous comment:

Mikhail: I can reproduce what you are saying but only when selecting multiple consequent bottom-most messages.

Here some example configurations showing the four bottom-most messages with "-----" representing a non-selected message and "*****" a selected one:

These are working as expected:

-----
*****
*****
-----

and

-----
-----
-----
*****

and

-----
*****
-----
*****

NOT working (no selection after deleting the selection):

-----
-----
*****
*****

or

-----
*****
*****
*****

etc.
Comment 6 Mikhail Zabaluev 2006-10-03 08:49:41 UTC
I have the View setting enabled to hide deleted messages.
Oddly, when I select _multiple_ messages and delete them, the selection does move to the next message in the list!
I observe this in the local Inbox folder, so no IMAP involved.
Comment 7 Christof Krüger 2006-10-03 13:35:12 UTC
Do you have "Group by threads" enabled?
Because I had not and the behavior was as described above. Now I have turned it on and I have the same behavior as you described.

After deleting the messages it seems to select the first not-deleted message if founds, starting searching from the message that was selected last (using ctrl+click, shift-click or shift-<down-arrow>). In consequence, if the last selected message is the bottom-most one, it doesn't work again.

Comment 8 Mikhail Zabaluev 2006-10-03 21:38:53 UTC
(In reply to comment #7)
> Do you have "Group by threads" enabled?
> Because I had not and the behavior was as described above. Now I have turned it
> on and I have the same behavior as you described.

Yes I confirm that.
Comment 9 Christof Krüger 2007-01-23 07:09:27 UTC
This is still buggy with Evolution 2.9.5 (on Ubuntu feisty).

Having the bottom-most message selected and hitting the "junk" button (and I receive a lot of junk) makes the selected message disappear (it's moved to the junk folder) leaving my current view without a valid selection. This leads to the behaviour described above: the view is scrolled to the very top the next time I reload the view or use cursor keys to navigate.

As we already have found out that some cases/combinations are already covered, I would appreciate it if a dev could point me to the relevant places in the source code. That way I could see what is already done (and HOW it is done, as I'm unfamiliar with evolution code atm) and possibly derive a more general implementation that covers _all_ cases from it.
Comment 10 Christof Krüger 2007-03-12 11:51:15 UTC
Created attachment 84424 [details] [review]
bugfix

This patch should fix the problem by not only searching for undeleted messages _below_ the currently selected one but also _above_ if the former fails. Thus, if deleting the bottom-most message, the now bottom-most will be selected instead of not having any selection at all.
Comment 11 Srinivasa Ragavan 2007-03-15 06:54:18 UTC
Christof, the patch looks fine. It fixes the problem of not selecting the right mails on deletion. I tried another scenario. Went to junk folder. Selected the last message and chose NOT JUNK. It lost the selection as this. Im sure that you can address this too. Thanks for this awesome patch.
Comment 12 Christof Krüger 2007-03-15 14:38:24 UTC
Created attachment 84654 [details] [review]
bugfix revision 2

This gets a little bit complicated now.

The original function was called find_next_undeleted but was also called when dealing with junk or trash folders. Since it's just a static function it can be renamed safely. I called it find_next_selectable because this is what it actually should do. The caller of the function later selects the entry this function returned.

Now comes the complicated part: What we are looking after in this function depends on the folder type we are currently in. When we're in the trash folder we are _not_ looking for undeleted messages but for deleted ones. When in a junk folder, we look for junk mail but not deleted ones in the case of hidedeleted.

In order to deal with all the cases, I've written a helper function is_node_selectable. I tried to write some comments that should make clear what the patch does in detail.

While it works for me so far, I'm not sure if this could be implemented in a more concise way and if it does not introduce some bugs because of evolution being a multithreaded application. Please check if I access something (namely ml->folder->folder_flags) that could cause problems.
Comment 13 Srinivasa Ragavan 2007-03-17 20:35:03 UTC
Hey Christof, I dont see any problems, as the current code too does that. The patch works awesomely great for me. I dont see any straight forward issues. Just commit to Stable and Head branches.
Comment 14 Christof Krüger 2007-03-18 00:07:54 UTC
Great. I'm not sure about what you meant by saying "Just commit to Stable and Head branches." Is there something I can do from here on? Or was it directed to some evolution developer?
Comment 15 André Klapper 2007-04-01 21:50:27 UTC
Christof: Do you have permission to commit to GNOME SVN? If not, Srini should do this...
Comment 16 Srinivasa Ragavan 2007-04-02 05:17:27 UTC
I will commit this along with release. 
Comment 17 Matthew Barnes 2007-04-06 13:26:35 UTC
Committed to trunk (revision 33394) and the gnome-2-18 branch (revision 33395) with some minor refactoring to fix compiler warnings introduced by this patch (flags used uninitialized, unused variable, etc.).

Wanted to make sure this gets into 2.10.1.