# HG changeset patch # User Tim Ringenbach # Date 1089164127 0 # Node ID 8a4797a608ae399ff18eeb2330c0eed2cc805460 # Parent 4a69de50f11a4e994614d9a0d06894f6fa50c76e [gaim-migrate @ 10290] 1) Fixes the parsing for Win32 clipboard format so that we more accurately grab the right text 2) Revises our Win32 clipboard format conversion to act more like IE, since this is as close as we will get to "the right way" 3) Makes clipboard pasting not paste HTML comments (this one effects linux too, and fixes a problem i've seen pasting from oo.o) committer: Tailor Script diff -r 4a69de50f11a -r 8a4797a608ae src/gtkimhtml.c --- a/src/gtkimhtml.c Tue Jul 06 23:16:20 2004 +0000 +++ b/src/gtkimhtml.c Wed Jul 07 01:35:27 2004 +0000 @@ -149,13 +149,44 @@ static gchar * clipboard_win32_to_html(char *clipboard) { + const char *header; const char *begin, *end; + gint start=0; + gint finish=0; gchar *html; - - begin = strstr(clipboard, ""); + g_string_append(clipboard, g_strdup_printf("EndHTML:%010d\r\n", 147 + length)); + g_string_append(clipboard, "StartFragment:0000000127\r\n"); + g_string_append(clipboard, g_strdup_printf("EndFragment:%010d\r\n", 127 + length)); + g_string_append(clipboard, "\r\n"); g_string_append(clipboard, html); - g_string_append(clipboard, ""); + g_string_append(clipboard, "\r\n"); ret = clipboard->str; g_string_free(clipboard, FALSE); + +#if 0 /* Debugging for Windows clipboard */ + gaim_debug_info("imhtml clipboard", "from gaim: %s\n", ret); +#endif + return ret; } #endif @@ -725,7 +761,7 @@ static void imhtml_paste_insert(GtkIMHtml *imhtml, const char *text, gboolean plaintext) { GtkTextIter iter; - GtkIMHtmlOptions flags = plaintext ? 0 : GTK_IMHTML_NO_NEWLINE; + GtkIMHtmlOptions flags = plaintext ? 0 : (GTK_IMHTML_NO_NEWLINE | GTK_IMHTML_NO_COMMENTS); if (gtk_text_buffer_get_selection_bounds(imhtml->text_buffer, NULL, NULL)) gtk_text_buffer_delete_selection(imhtml->text_buffer, TRUE, TRUE); @@ -2463,9 +2499,10 @@ case 62: /* comment */ /* NEW_BIT (NEW_TEXT_BIT); */ ws[wpos] = '\0'; + gtk_text_buffer_insert(imhtml->text_buffer, iter, ws, wpos); - if (imhtml->show_comments) + if (imhtml->show_comments && !(options & GTK_IMHTML_NO_COMMENTS)) wpos = g_snprintf (ws, len, "%s", tag); /* NEW_BIT (NEW_COMMENT_BIT); */ break;