changeset 9621:de9c4dc072b5

[gaim-migrate @ 10465] This fixesan annoying problem wherepasting from Mozillawould not contain word breaks betweensome word for no apparent reason. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Sat, 31 Jul 2004 21:48:21 +0000
parents c001be3c330e
children 3f0d8ccefd7f
files src/gtkimhtml.c
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkimhtml.c	Sat Jul 31 21:29:40 2004 +0000
+++ b/src/gtkimhtml.c	Sat Jul 31 21:48:21 2004 +0000
@@ -836,7 +836,7 @@
 		tmp = g_utf8_next_char(text);
 		memmove(text, tmp, strlen(tmp) + 1);
 	}
-
+	
 	if (!(*text) || !g_utf8_validate(text, -1, NULL)) {
 		gaim_debug_warning("gtkimhtml", "empty string or invalid UTF-8 in paste_received_cb\n");
 		g_free(text);
@@ -2546,6 +2546,17 @@
 				ws[0] = '\0';
 				wpos = 0;
 				/* NEW_BIT (NEW_TEXT_BIT); */
+			} else {
+				/* A newline is defined by HTML as whitespace, which means we have to replace it with a word boundary.
+				 * word breaks vary depending on the language used, so the correct thing to do is to use Pango to determine
+				 * what language this is, determine the proper word boundary to use, and insert that. I'm just going to insert
+				 * a space instead.  What are the non-English speakers going to do?  Complain in a language I'll understand?
+				 * Bu-wahaha! */
+				ws[wpos] = ' ';
+				wpos++;
+				gtk_text_buffer_insert(imhtml->text_buffer, iter, ws, wpos);
+				ws[0] = '\0';
+				wpos = 0;
 			}
 			c++;
 			pos++;