[geary/wip/794700-lazy-load-conversations: 10/19] Scroll to the first matching message when highlighting search terms



commit ac9efc44c6c7e151611723e5c5599cae2c698cc3
Author: Michael Gratton <mike vee net>
Date:   Fri Jan 18 12:38:23 2019 +1100

    Scroll to the first matching message when highlighting search terms

 src/client/conversation-viewer/conversation-list-box.vala | 12 ++++++++++++
 1 file changed, 12 insertions(+)
---
diff --git a/src/client/conversation-viewer/conversation-list-box.vala 
b/src/client/conversation-viewer/conversation-list-box.vala
index 8fbcb7f1..c10919a5 100644
--- a/src/client/conversation-viewer/conversation-list-box.vala
+++ b/src/client/conversation-viewer/conversation-list-box.vala
@@ -658,6 +658,18 @@ public class ConversationListBox : Gtk.ListBox, Geary.BaseInterface {
             );
 
             if (this.search_terms != null) {
+                EmailRow? first = null;
+                foreach (Geary.EmailIdentifier id in matching) {
+                    EmailRow? row = this.email_rows.get(id);
+                    if (row != null &&
+                        (first == null || row.get_index() < first.get_index())) {
+                        first = row;
+                    }
+                }
+                if (first != null) {
+                    scroll_to(first);
+                }
+
                 foreach (Geary.EmailIdentifier id in matching) {
                     EmailRow? row = this.email_rows.get(id);
                     if (row != null) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]