Philipp Hörist pushed to branch gajim_0.16 at gajim / gajim

Commits:

1 changed file:

Changes:

  • src/history_window.py
    ... ... @@ -75,6 +75,8 @@ class HistoryWindow:
    75 75
             self.history_buffer = self.history_textview.tv.get_buffer()
    
    76 76
             self.history_buffer.create_tag('highlight', background = 'yellow')
    
    77 77
             self.history_buffer.create_tag('invisible', invisible=True)
    
    78
    +        self.eom_tag = self.history_buffer.create_tag('endofmessage',
    
    79
    +            invisible=True)
    
    78 80
             self.checkbutton = xml.get_object('log_history_checkbutton')
    
    79 81
             self.checkbutton.connect('toggled',
    
    80 82
                 self.on_log_history_checkbutton_toggled)
    
    ... ... @@ -515,7 +517,7 @@ class HistoryWindow:
    515 517
             else:
    
    516 518
                 self.history_textview.print_real_text(message, name=contact_name,
    
    517 519
                     xhtml=xhtml)
    
    518
    -        self.history_textview.print_real_text('\n')
    
    520
    +        self.history_textview.print_real_text('\n', ['endofmessage'])
    
    519 521
     
    
    520 522
         def on_query_entry_activate(self, widget):
    
    521 523
             text = self.query_entry.get_text()
    
    ... ... @@ -624,13 +626,10 @@ class HistoryWindow:
    624 626
             self.calendar.select_day(day)
    
    625 627
             unix_time = model[path][C_TIME]
    
    626 628
             self._scroll_to_result(unix_time)
    
    627
    -        #FIXME: one day do not search just for unix_time but the whole and user
    
    628
    -        # specific format of the textbuffer line [time] nick: message
    
    629
    -        # and highlight all that
    
    630 629
     
    
    631 630
         def _scroll_to_result(self, unix_time):
    
    632 631
             """
    
    633
    -        Scroll to the result using unix_time and highlight line
    
    632
    +        Scroll to the result using unix_time and highlight message
    
    634 633
             """
    
    635 634
             start_iter = self.history_buffer.get_start_iter()
    
    636 635
             local_time = time.localtime(float(unix_time))
    
    ... ... @@ -641,9 +640,9 @@ class HistoryWindow:
    641 640
                     None)
    
    642 641
             if result is not None:
    
    643 642
                 match_start_iter, match_end_iter = result
    
    644
    -            # include '[' or other character before time
    
    645
    -            match_start_iter.backward_char()
    
    646
    -            match_end_iter.forward_line() # highlight all message not just time
    
    643
    +            while not match_end_iter.has_tag(self.eom_tag):
    
    644
    +                if not match_end_iter.forward_to_line_end():
    
    645
    +                    break
    
    647 646
                 self.history_buffer.apply_tag_by_name('highlight', match_start_iter,
    
    648 647
                     match_end_iter)
    
    649 648