print correctly when we correct a /me message. Fixes #7400

This commit is contained in:
Yann Leboulanger 2013-08-13 21:18:44 +02:00
parent b46a56953d
commit 25ed96236f
2 changed files with 13 additions and 7 deletions

View File

@ -1394,8 +1394,8 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
end_iter = msg_buf.get_end_iter()
self.orig_msg = msg_buf.get_text(start_iter, end_iter, False)
if pos == size and size > 0 and direction == 'up' and \
msg_type == 'sent' and not self.correcting and not \
history[pos - 1].startswith('/'):
msg_type == 'sent' and not self.correcting and (not \
history[pos - 1].startswith('/') or history[pos - 1].startswith('/me')):
self.correcting = True
context = self.msg_textview.get_style_context()
state = Gtk.StateFlags.NORMAL
@ -3032,14 +3032,14 @@ class ChatControl(ChatControlBase):
xhtml = None
if row[2].startswith('<body '):
xhtml = row[2]
ChatControlBase.print_conversation_line(self, row[2], kind, name,
tim, small_attr, small_attr + ['restored_message'],
small_attr + ['restored_message'], False,
old_kind=local_old_kind, xhtml=xhtml)
if row[2].startswith('/me ') or row[2].startswith('/me\n'):
local_old_kind = None
else:
local_old_kind = kind
ChatControlBase.print_conversation_line(self, row[2], kind, name,
tim, small_attr, small_attr + ['restored_message'],
small_attr + ['restored_message'], False,
old_kind=local_old_kind, xhtml=xhtml)
if len(rows):
self.conv_textview.print_empty_line()

View File

@ -491,7 +491,10 @@ class ConversationTextview(GObject.GObject):
i2 = buffer_.get_iter_at_mark(m2)
txt = buffer_.get_text(i1, i2, True)
buffer_.delete(i1, i2)
i2 = self.print_real_text(message, text_tags=['outgoingtxt'], name=name,
tag = 'outgoingtxt'
if message.startswith('/me'):
tag = 'outgoing'
i2 = self.print_real_text(message, text_tags=[tag], name=name,
xhtml=xhtml, iter_=i1)
tt_txt = _('<b>Message was corrected. Last message was:</b>\n %s') % \
old_txt
@ -1353,6 +1356,9 @@ class ConversationTextview(GObject.GObject):
if other_text_tag:
# note that color of /me may be overwritten in gc_control
text_tags.append(other_text_tag)
if text.startswith('/me'):
mark1 = buffer_.create_mark(None, buffer_.get_end_iter(),
left_gravity=True)
else: # not status nor /me
if gajim.config.get('chat_merge_consecutive_nickname'):
if kind != old_kind or self.just_cleared: