# HG changeset patch # User Tim Ringenbach # Date 1089164127 0 # Node ID 652dcd45db7d6636c4f6dafbbdac3fce243e720c # Parent 999be2b43a770d6a8874a1a2476c9b657cc0c638 [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) diff -r 999be2b43a77 -r 652dcd45db7d 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;