fix scrolling pb: we now look at if we are at the end of the textview BEFORE we print a line
This commit is contained in:
parent
046484684a
commit
bfc024bfca
|
@ -583,9 +583,14 @@ class Chat:
|
||||||
conversation_textview = self.xmls[jid].get_widget('conversation_textview')
|
conversation_textview = self.xmls[jid].get_widget('conversation_textview')
|
||||||
conversation_buffer = conversation_textview.get_buffer()
|
conversation_buffer = conversation_textview.get_buffer()
|
||||||
print_all_special = False
|
print_all_special = False
|
||||||
|
at_the_end = False
|
||||||
|
end_iter = conversation_buffer.get_end_iter()
|
||||||
|
end_rect = conversation_textview.get_iter_location(end_iter)
|
||||||
|
visible_rect = conversation_textview.get_visible_rect()
|
||||||
|
if end_rect.y <= (visible_rect.y + visible_rect.height):
|
||||||
|
at_the_end = True
|
||||||
if not text:
|
if not text:
|
||||||
text = ''
|
text = ''
|
||||||
end_iter = conversation_buffer.get_end_iter()
|
|
||||||
if conversation_buffer.get_char_count() > 0:
|
if conversation_buffer.get_char_count() > 0:
|
||||||
conversation_buffer.insert(end_iter, '\n')
|
conversation_buffer.insert(end_iter, '\n')
|
||||||
if self.plugin.config['print_time'] == 'always':
|
if self.plugin.config['print_time'] == 'always':
|
||||||
|
@ -628,12 +633,8 @@ class Chat:
|
||||||
conversation_buffer.insert(end_iter, text[index:])
|
conversation_buffer.insert(end_iter, text[index:])
|
||||||
|
|
||||||
#scroll to the end of the textview
|
#scroll to the end of the textview
|
||||||
end_iter = conversation_buffer.get_end_iter()
|
|
||||||
end_rect = conversation_textview.get_iter_location(end_iter)
|
|
||||||
visible_rect = conversation_textview.get_visible_rect()
|
|
||||||
end = False
|
end = False
|
||||||
if end_rect.y <= (visible_rect.y + visible_rect.height) or \
|
if at_the_end or (kind == 'outgoing'):
|
||||||
(kind == 'outgoing'):
|
|
||||||
#we are at the end or we are sending something
|
#we are at the end or we are sending something
|
||||||
end = True
|
end = True
|
||||||
# We scroll to the end after the scrollbar has appeared
|
# We scroll to the end after the scrollbar has appeared
|
||||||
|
|
Loading…
Reference in New Issue