@@ -814,17 +814,29 @@ def _get_buffer(self, key, text):
814814 def _get_buffer_for_day (self , day ):
815815 return self ._get_buffer (day .date , day .text )
816816
817+ def scroll_to_text (self , queries ):
818+ """
819+ Finds the first non-date word in queries, and passes it on to
820+ `Editor.scroll_to_text`.
821+ """
822+ for word in queries :
823+ # If word matches date, it probably is not present in the text.
824+ if word in str (self .day ):
825+ pass
826+ else :
827+ super ().scroll_to_text (word )
828+
817829 def show_day (self , new_day ):
818830 # Show new day
819831 self .day = new_day
820832 buf = self ._get_buffer_for_day (new_day )
821833 self .replace_buffer (buf )
822834 self .day_text_view .grab_focus ()
823835
824- if self .search_text :
836+ if self .search_queries :
825837 # If a search is currently made, scroll to the text and return.
826- GObject .idle_add (self .scroll_to_text , self .search_text )
827- GObject .idle_add (self .highlight , self .search_text )
838+ GObject .idle_add (self .scroll_to_text , self .search_queries )
839+ GObject .idle_add (self .highlight , self .search_queries )
828840 return
829841
830842 def show_template (self , title , text ):
0 commit comments