/pidgin/main: ac3d0b6d6128: gtkconv: Fix alignment of incoming R...

dx dx at dxzone.com.ar
Mon Apr 11 11:36:48 EDT 2016


Changeset: ac3d0b6d6128ce326249147b73d8b26325be1f78
Author:	 dx <dx at dxzone.com.ar>
Date:	 2016-04-11 04:22 -0300
Branch:	 release-2.x.y
URL: https://hg.pidgin.im/pidgin/main/rev/ac3d0b6d6128

Description:

gtkconv: Fix alignment of incoming RTL messages in protocols without rich text

Which means this probably only worked properly for XMPP, given a pidgin client
on the other side which also sent that span tag with direction:rtl. In the case
of outgoing messages, it worked because that span tag was added by pidgin's own
input box.

diffstat:

 ChangeLog        |   2 ++
 pidgin/gtkconv.c |  13 +++++++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)

diffs (35 lines):

diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,8 @@ Pidgin and Finch: The Pimpin' Penguin IM
 version 2.10.13 (MM/DD/YY):
 	Pidgin:
 	* Fixed #14962
+	* Fixed alignment of incoming right-to-left messages in protocols that
+	don't support rich text
 
 	Windows-Specific Changes:
 	* Use getaddrinfo for DNS to enable IPv6 (#1075)
diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c
--- a/pidgin/gtkconv.c
+++ b/pidgin/gtkconv.c
@@ -5914,6 +5914,19 @@ pidgin_conv_write_conv(PurpleConversatio
 
 	/* Bi-Directional support - set timestamp direction using unicode characters */
 	is_rtl_message = purple_markup_is_rtl(message);
+
+	/* Handle plaintext messages with RTL text but no direction in the markup */
+	if (!is_rtl_message && pango_find_base_dir(message, -1) == PANGO_DIRECTION_RTL)
+	{
+		char *wrapped = g_strdup_printf("<SPAN style=\"direction:rtl;text-align:right;\">%s</SPAN>", displaying);
+
+		g_free(displaying);
+		displaying = wrapped;
+
+		length = strlen(displaying) + 1;
+		is_rtl_message = TRUE;
+	}
+
 	/* Enforce direction only if message is RTL - doesn't effect LTR users */
 	if (is_rtl_message)
 		str_embed_direction_chars(&mdate);



More information about the Commits mailing list