Package: pidgin
Version: 2.10.11-1.1a
Severity: important
Tags: upstream patch

Dear Maintainer,

This is a bugfix by DX, the change is backporte to 2.10.11

Ref: purple-facebook issue #233 - the first screenshot shows the correct
behavior (all RTL messages to the right), the last/third screenshot
shows the wrong behavior (remote message to the left even though it's
RTL). Another user on irc reported a very similar issue with a different
prpl.

Already tested, ran under valgrind and working as expected.

str_embed_direction_chars() was not used here. It applied the correct
direction to the individual components (message, nick, timestamp) but
resulted in a left-aligned message - despite what the <SPAN> tag may
suggest, it's not an inline tag, but affects the block level.

This is specific to release-2.x.y - the 3.x branch seems to have
different issues with RTL, and i'd expect webkit to handle any span tags
differently

-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (901, 'unstable'), (900, 'testing'), (200, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.4.0-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=he_IL.UTF-8, LC_CTYPE=he_IL.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages pidgin depends on:
ii  gconf2                      3.2.6-3
ii  libatk1.0-0                 2.18.0-1
ii  libc6                       2.22-1
ii  libcairo2                   1.14.6-1
ii  libdbus-1-3                 1.10.8-1
ii  libdbus-glib-1-2            0.106-1
ii  libfontconfig1              2.11.0-6.3
ii  libfreetype6                2.6.3-3
ii  libgadu3                    1:1.12.1-2+b1
ii  libgdk-pixbuf2.0-0          2.32.3-1.2
ii  libglib2.0-0                2.46.2-3
ii  libgstreamer1.0-0           1.6.3-1
ii  libgtk2.0-0                 2.24.30-1
ii  libgtkspell0                2.0.16-1.1
ii  libice6                     2:1.0.9-1+b1
ii  libpango-1.0-0              1.38.1-1
ii  libpangocairo-1.0-0         1.38.1-1
ii  libpangoft2-1.0-0           1.38.1-1
ii  libpurple0                  2.10.11-1.1a
ii  libsm6                      2:1.2.2-1+b1
ii  libx11-6                    2:1.6.3-1
ii  libxss1                     1:1.2.2-1
ii  perl-base [perlapi-5.22.1]  5.22.1-8
ii  pidgin-data                 2.10.11-1.1a

Versions of packages pidgin recommends:
ii  gstreamer1.0-libav         1.6.3-1
ii  gstreamer1.0-plugins-base  1.6.3-1
ii  gstreamer1.0-plugins-good  1.6.3-1
ii  gstreamer1.0-pulseaudio    1.6.3-1

Versions of packages pidgin suggests:
ii  libsqlite3-0  3.11.1-1

-- no debconf information
diff -ENwbur pidgin-2.10.11/debian/changelog pidgin-2.10.11a/debian/changelog
--- pidgin-2.10.11/debian/changelog	2015-10-17 20:56:47.000000000 +0300
+++ pidgin-2.10.11a/debian/changelog	2016-04-11 12:51:33.036006395 +0300
@@ -1,3 +1,7 @@
+pidgin (2.10.11-1.1a) unstable; urgency=medium
+  * Bug fix RTL
+ -- dx <[email protected]>  Sat, 10 Apr 2016 20:55:57 +0300
+
 pidgin (2.10.11-1.1) unstable; urgency=medium
 
   [ Bernhard Schmidt ]
diff -ENwbur pidgin-2.10.11/pidgin/gtkconv.c pidgin-2.10.11a/pidgin/gtkconv.c
--- pidgin-2.10.11/pidgin/gtkconv.c	2014-11-23 18:41:26.000000000 +0200
+++ pidgin-2.10.11a/pidgin/gtkconv.c	2016-04-11 12:52:14.739482111 +0300
@@ -5914,6 +5914,18 @@
 
 	/* 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);

Reply via email to