client: Fix next conversation selection on mail merge

When conversation monitor is merging emails, we need to calculate
next selected conversation. This may happen even if no conversation is
currently selected resulting on second conversation being selected.

Only return a valid conversation if current selection is not empty.
This commit is contained in:
Cédric Bellegarde 2023-03-20 07:05:48 +01:00 committed by Niels De Graef
parent aaaf657b35
commit f4ea4a282a

View file

@ -512,8 +512,14 @@ public class ConversationList.View : Gtk.ScrolledWindow, Geary.BaseInterface {
*/ */
private Gtk.ListBoxRow? get_next_conversation(bool asc=true) { private Gtk.ListBoxRow? get_next_conversation(bool asc=true) {
int index = asc ? 0 : int.MAX; int index = asc ? 0 : int.MAX;
GLib.List<unowned Gtk.ListBoxRow> selected_rows;
foreach (Gtk.ListBoxRow row in this.list.get_selected_rows().copy()) { selected_rows = this.list.get_selected_rows();
if (selected_rows.length() == 0 ) {
return null;
}
foreach (var row in selected_rows) {
if ((asc && row.get_index() > index) || if ((asc && row.get_index() > index) ||
(!asc && row.get_index() < index)) { (!asc && row.get_index() < index)) {
index = row.get_index(); index = row.get_index();